diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 875cbbe04a24b5edfac69920c21276ad836efaf9..34487bc9fe0475e66a29560559367d46ef8daeca 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -717,7 +717,6 @@ class ConnectionDisco: iq = iq_obj.buildReply('result') q = iq.getTag('query') if node: - print node q.setAttr('node', node) q.addChild('identity', attrs = {'type': 'pc', 'category': 'client', 'name': 'Gajim'}) @@ -1512,7 +1511,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, ''' Called when we receive <message/> with pubsub event. ''' # TODO: Logging? (actually services where logging would be useful, should # TODO: allow to access archives remotely...) - jid = msg.getAttr('from') + jid = helpers.get_jid_from_iq(msg) event = msg.getTag('event') # XEP-0107: User Mood diff --git a/src/common/contacts.py b/src/common/contacts.py index 724f8853cc38afd07528c58569b3ae554c25ea8d..26e916a8f91fe8757c737f3b74b8bb0fd9ee1200 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -18,7 +18,7 @@ import common.gajim class Contact: '''Information concerning each contact''' - def __init__(self, jid='', name='', groups=[], show='', status='', mood='', activity='', sub='', + def __init__(self, jid='', name='', groups=[], show='', status='', mood={}, activity={}, sub='', ask='', resource='', priority=0, keyID='', our_chatstate=None, chatstate=None, last_status_time=None, msg_id = None, composing_jep = None): self.jid = jid @@ -141,7 +141,7 @@ class Contacts: del self._gc_contacts[account] del self._metacontacts_tags[account] - def create_contact(self, jid='', name='', groups=[], show='', status='', mood='', activity='', + def create_contact(self, jid='', name='', groups=[], show='', status='', mood={}, activity={}, sub='', ask='', resource='', priority=0, keyID='', our_chatstate=None, chatstate=None, last_status_time=None, composing_jep=None): return Contact(jid, name, groups, show, status, mood, diff --git a/src/common/pep.py b/src/common/pep.py index 2fab1b44ddd82781ae581c5056802c716ada4814..3ca936ef9cae781b6605a3e97923d5ac790761f4 100644 --- a/src/common/pep.py +++ b/src/common/pep.py @@ -1,17 +1,19 @@ from common import gajim +#from common import helpers def user_mood(items, name, jid): - contacts = gajim.contacts.get_contact(name, jid) + (user, resource) = gajim.get_room_and_nick_from_fjid(jid) + contacts = gajim.contacts.get_contact(name, user, resource=resource) for item in items.getTags('item'): child = item.getTag('mood') if child is not None: for ch in child.getChildren(): if ch.getName() != 'text': for contact in contacts: - contact.mood = ch.getName() + contact.mood['mood'] = ch.getName() else: for contact in contacts: - contact.mood_text = ch.getData() + contact.mood['text'] = ch.getData() def user_tune(items, name, jid): pass @@ -20,14 +22,18 @@ def user_geoloc(items, name, jid): pass def user_activity(items, name, jid): - contacts = gajim.contacts.get_contact(name, jid) + (user, resource) = gajim.get_room_and_nick_from_fjid(jid) + contacts = gajim.contacts.get_contact(name, user, resource=resource) for item in items.getTags('item'): child = item.getTag('activity') if child is not None: for ch in child.getChildren(): if ch.getName() != 'text': for contact in contacts: - contact.activity = ch.getName() + contact.activity['activity'] = ch.getName() + for chi in ch.getChildren(): + for contact in contacts: + contact.activity['subactivity'] = chi.getName() else: for contact in contacts: - contact.activity_text = ch.getData() + contact.activity['text'] = ch.getData() diff --git a/src/tooltips.py b/src/tooltips.py index fefa63cdf6634544f81f0dd145486d37e4e03b3a..cd44706fbd74d68cbf1005a59834081fa5b5905a 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -478,17 +478,27 @@ class RosterTooltip(NotificationAreaTooltip): show = '<i>' + show + '</i>' # we append show below - if contact.mood: - mood = contact.mood.strip() - mood_text = contact.mood_text.strip() + if contact.mood.has_key('mood'): + mood = contact.mood['mood'].strip() + if contact.mood.has_key('text'): + mood_text = contact.mood['text'].strip() + else: + mood_text = '' if mood: - properties.append(('<b>%s:</b> %s' % (mood, mood_text), None)) + properties.append(('Mood: <b>%s</b> (%s)' % (mood, mood_text), None)) - if contact.activity: - activity = contact.activity.strip() - activity_text = contact.activity_text.strip() - if activity: - properties.append(('<b>%s:</b> %s' % (activity, activity_text), None)) + if contact.activity.has_key('activity'): + activity = contact.activity['activity'].strip() + activity_string = 'Activity: <b>%s' % activity + if contact.activity.has_key('subactivity'): + activity_sub = contact.activity['subactivity'].strip() + activity_string += ' (%s)</b>' % activity_sub + else: + activity_string += '</b>' + if contact.activity.has_key('text'): + activity_text = contact.activity['text'].strip() + activity_string += ' (%s)' % activity_text + properties.append((activity_string, None)) if contact.status: status = contact.status.strip()