Changeset 9137
- Timestamp:
- 12/13/07 21:26:13 (12 months ago)
- Location:
- trunk
- Files:
-
- 7 modified
-
src/common/connection.py (modified) (1 diff)
-
src/common/contacts.py (modified) (4 diffs)
-
src/common/pep.py (modified) (2 diffs)
-
src/common/zeroconf/connection_zeroconf.py (modified) (1 diff)
-
src/roster_window.py (modified) (1 diff)
-
src/tooltips.py (modified) (3 diffs)
-
TODO.pep (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common/connection.py
r9125 r9137 143 143 self.blocked_groups = [] 144 144 self.pep_supported = False 145 self.mood = {} 146 self.tune = {} 147 self.activity = {} 145 148 # Do we continue connection when we get roster (send presence,get vcard..) 146 149 self.continue_connect_info = None -
trunk/src/common/contacts.py
r9125 r9137 28 28 def __init__(self, jid='', name='', groups=[], show='', status='', sub='', 29 29 ask='', resource='', priority=0, keyID='', our_chatstate=None, 30 chatstate=None, last_status_time=None, msg_id = None, composing_xep = None): 30 chatstate=None, last_status_time=None, msg_id = None, composing_xep = None, 31 mood={}, tune={}, activity={}): 31 32 self.jid = jid 32 33 self.name = name … … 35 36 self.show = show 36 37 self.status = status 37 # FIXME38 self.mood = dict()39 self.activity = dict()40 self.tune = dict()41 38 self.sub = sub 42 39 self.ask = ask … … 68 65 self.last_status_time = last_status_time 69 66 67 self.mood = mood.copy() 68 self.tune = tune.copy() 69 self.activity = activity.copy() 70 70 71 def get_full_jid(self): 71 72 if self.resource: … … 167 168 def create_contact(self, jid='', name='', groups=[], show='', status='', 168 169 sub='', ask='', resource='', priority=0, keyID='', our_chatstate=None, 169 chatstate=None, last_status_time=None, composing_xep=None): 170 chatstate=None, last_status_time=None, composing_xep=None, 171 mood={}, tune={}, activity={}): 170 172 return Contact(jid, name, groups, show, status, sub, ask, resource, 171 173 priority, keyID, our_chatstate, chatstate, last_status_time, 172 composing_xep)174 None, composing_xep, mood, tune, activity) 173 175 174 176 def copy_contact(self, contact): -
trunk/src/common/pep.py
r9127 r9137 2 2 3 3 def user_mood(items, name, jid): 4 has_child = False 5 mood = None 6 text = None 7 for item in items.getTags('item'): 8 child = item.getTag('mood') 9 if child is not None: 10 has_child = True 11 for ch in child.getChildren(): 12 if ch.getName() != 'text': 13 mood = ch.getName() 14 else: 15 text = ch.getData() 16 if jid == gajim.get_jid_from_account(name): 17 acc = gajim.connections[name] 18 if has_child: 19 if acc.mood.has_key('mood'): 20 del acc.mood['mood'] 21 if acc.mood.has_key('text'): 22 del acc.mood['text'] 23 if mood != None: 24 acc.mood['mood'] = mood 25 if text != None: 26 acc.mood['text'] = text 27 4 28 (user, resource) = gajim.get_room_and_nick_from_fjid(jid) 5 29 contact = gajim.contacts.get_contact(name, user, resource=resource) 6 30 if not contact: 7 31 return 32 if has_child: 33 if contact.mood.has_key('mood'): 34 del contact.mood['mood'] 35 if contact.mood.has_key('text'): 36 del contact.mood['text'] 37 if mood != None: 38 contact.mood['mood'] = mood 39 if text != None: 40 contact.mood['text'] = text 41 42 def user_tune(items, name, jid): 43 has_child = False 44 artist = None 45 title = None 46 source = None 47 track = None 48 length = None 49 8 50 for item in items.getTags('item'): 9 child = item.getTag(' mood')51 child = item.getTag('tune') 10 52 if child is not None: 11 if contact.mood.has_key('mood'): 12 del contact.mood['mood'] 13 if contact.mood.has_key('text'): 14 del contact.mood['text'] 53 has_child = True 15 54 for ch in child.getChildren(): 16 if ch.getName() != 'text': 17 contact.mood['mood'] = ch.getName() 18 else: 19 contact.mood['text'] = ch.getData() 20 21 def user_tune(items, name, jid): 55 if ch.getName() == 'artist': 56 artist = ch.getData() 57 elif ch.getName() == 'title': 58 title = ch.getData() 59 elif ch.getName() == 'source': 60 source = ch.getData() 61 elif ch.getName() == 'track': 62 track = ch.getData() 63 elif ch.getName() == 'length': 64 length = ch.getData() 65 66 if jid == gajim.get_jid_from_account(name): 67 acc = gajim.connections[name] 68 if has_child: 69 if acc.tune.has_key('artist'): 70 del acc.tune['artist'] 71 if acc.tune.has_key('title'): 72 del acc.tune['title'] 73 if acc.tune.has_key('source'): 74 del acc.tune['source'] 75 if acc.tune.has_key('track'): 76 del acc.tune['track'] 77 if acc.tune.has_key('length'): 78 del acc.tune['length'] 79 if artist != None: 80 acc.tune['artist'] = artist 81 if title != None: 82 acc.tune['title'] = title 83 if source != None: 84 acc.tune['source'] = source 85 if track != None: 86 acc.tune['track'] = track 87 if length != None: 88 acc.tune['length'] = length 89 22 90 (user, resource) = gajim.get_room_and_nick_from_fjid(jid) 23 91 contact = gajim.contacts.get_contact(name, user, resource=resource) 24 92 if not contact: 25 93 return 26 for item in items.getTags('item'): 27 child = item.getTag('tune') 28 if child is not None: 29 if contact.tune.has_key('artist'): 30 del contact.tune['artist'] 31 if contact.tune.has_key('title'): 32 del contact.tune['title'] 33 if contact.tune.has_key('source'): 34 del contact.tune['source'] 35 if contact.tune.has_key('track'): 36 del contact.tune['track'] 37 if contact.tune.has_key('length'): 38 del contact.tune['length'] 39 for ch in child.getChildren(): 40 if ch.getName() == 'artist': 41 contact.tune['artist'] = ch.getData() 42 elif ch.getName() == 'title': 43 contact.tune['title'] = ch.getData() 44 elif ch.getName() == 'source': 45 contact.tune['source'] = ch.getData() 46 elif ch.getName() == 'track': 47 contact.tune['track'] = ch.getData() 48 elif ch.getName() == 'length': 49 contact.tune['length'] = ch.getData() 94 if has_child: 95 if contact.tune.has_key('artist'): 96 del contact.tune['artist'] 97 if contact.tune.has_key('title'): 98 del contact.tune['title'] 99 if contact.tune.has_key('source'): 100 del contact.tune['source'] 101 if contact.tune.has_key('track'): 102 del contact.tune['track'] 103 if contact.tune.has_key('length'): 104 del contact.tune['length'] 105 if artist != None: 106 contact.tune['artist'] = artist 107 if title != None: 108 contact.tune['title'] = title 109 if source != None: 110 contact.tune['source'] = source 111 if track != None: 112 contact.tune['track'] = track 113 if length != None: 114 contact.tune['length'] = length 50 115 51 116 def user_geoloc(items, name, jid): … … 53 118 54 119 def user_activity(items, name, jid): 120 has_child = False 121 activity = None 122 subactivity = None 123 text = None 124 125 for item in items.getTags('item'): 126 child = item.getTag('activity') 127 if child is not None: 128 has_child = True 129 for ch in child.getChildren(): 130 if ch.getName() != 'text': 131 activity = ch.getName() 132 for chi in ch.getChildren(): 133 subactivity = chi.getName() 134 else: 135 text = ch.getData() 136 137 if jid == gajim.get_jid_from_account(name): 138 acc = gajim.connections[name] 139 if has_child: 140 if acc.activity.has_key('activity'): 141 del acc.activity['activity'] 142 if acc.activity.has_key('subactivity'): 143 del acc.activity['subactivity'] 144 if acc.activity.has_key('text'): 145 del acc.activity['text'] 146 if activity != None: 147 acc.activity['activity'] = activity 148 if subactivity != None: 149 acc.activity['subactivity'] = subactivity 150 if text != None: 151 acc.activity['text'] = text 152 55 153 (user, resource) = gajim.get_room_and_nick_from_fjid(jid) 56 154 contact = gajim.contacts.get_contact(name, user, resource=resource) 57 155 if not contact: 58 156 return 59 for item in items.getTags('item'): 60 child = item.getTag('activity') 61 if child is not None: 62 if contact.activity.has_key('activity'): 63 del contact.activity['activity'] 64 if contact.activity.has_key('subactivity'): 65 del contact.activity['subactivity'] 66 if contact.activity.has_key('text'): 67 del contact.activity['text'] 68 for ch in child.getChildren(): 69 if ch.getName() != 'text': 70 contact.activity['activity'] = ch.getName() 71 for chi in ch.getChildren(): 72 contact.activity['subactivity'] = chi.getName() 73 else: 74 contact.activity['text'] = ch.getData() 157 if has_child: 158 if contact.activity.has_key('activity'): 159 del contact.activity['activity'] 160 if contact.activity.has_key('subactivity'): 161 del contact.activity['subactivity'] 162 if contact.activity.has_key('text'): 163 del contact.activity['text'] 164 if activity != None: 165 contact.activity['activity'] = activity 166 if subactivity != None: 167 contact.activity['subactivity'] = subactivity 168 if text != None: 169 contact.activity['text'] = text 75 170 76 171 def user_send_mood(account, mood, message = ''): -
trunk/src/common/zeroconf/connection_zeroconf.py
r9078 r9137 87 87 88 88 self.pep_supported = False 89 self.mood = {} 90 self.tune = {} 91 self.activity = {} 89 92 # Do we continue connection when we get roster (send presence,get vcard...) 90 93 self.continue_connect_info = None -
trunk/src/roster_window.py
r9136 r9137 1531 1531 status = connection.status, 1532 1532 resource = connection.server_resource, 1533 priority = connection.priority) 1533 priority = connection.priority, 1534 mood = connection.mood, 1535 tune = connection.tune, 1536 activity = connection.activity) 1534 1537 if gajim.connections[account].gpg: 1535 1538 contact.keyID = gajim.config.get_per('accounts', connection.name, -
trunk/src/tooltips.py
r9125 r9137 501 501 502 502 if contact.mood.has_key('mood'): 503 mood_string = 'Mood:<b>%s</b>' % contact.mood['mood'].strip()503 mood_string = _('Mood:') + ' <b>%s</b>' % contact.mood['mood'].strip() 504 504 if contact.mood.has_key('text') and contact.mood['text'] != '': 505 505 mood_string += ' (%s)' % contact.mood['text'].strip() … … 508 508 if contact.activity.has_key('activity'): 509 509 activity = contact.activity['activity'].strip() 510 activity_string = 'Activity:<b>%s' % activity510 activity_string = _('Activity:') + ' <b>%s' % activity 511 511 if contact.activity.has_key('subactivity'): 512 512 activity_sub = contact.activity['subactivity'].strip() … … 532 532 else: 533 533 source = _('Unknown Source') 534 tune_string = '♪' + _('<b>"%(title)s"</b> by <i>%(artist)s</i>\nfrom <i>%(source)s</i>' %\535 {'title': title, 'artist': artist, 'source': source}) + ' ♪'534 tune_string = _('Tune:') + ' ' + _('<b>"%(title)s"</b> by <i>%(artist)s</i>\nfrom <i>%(source)s</i>' %\ 535 {'title': title, 'artist': artist, 'source': source}) 536 536 properties.append((tune_string, None)) 537 537 -
trunk/TODO.pep
r9125 r9137 6 6 7 7 Tooltips use cases: 8 • Show PEP in contact tooltips9 8 • Show PEP in GC tooltips 10 • Show PEP in account tooltips11 9 12 10 Mood/Activity use cases
