diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index 875cbbe04..34487bc9f 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 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 724f8853c..26e916a8f 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 2fab1b44d..3ca936ef9 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 fefa63cdf..cd44706fb 100644
--- a/src/tooltips.py
+++ b/src/tooltips.py
@@ -478,17 +478,27 @@ class RosterTooltip(NotificationAreaTooltip):
show = '' + show + ''
# 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(('%s: %s' % (mood, mood_text), None))
+ properties.append(('Mood: %s (%s)' % (mood, mood_text), None))
- if contact.activity:
- activity = contact.activity.strip()
- activity_text = contact.activity_text.strip()
- if activity:
- properties.append(('%s: %s' % (activity, activity_text), None))
+ if contact.activity.has_key('activity'):
+ activity = contact.activity['activity'].strip()
+ activity_string = 'Activity: %s' % activity
+ if contact.activity.has_key('subactivity'):
+ activity_sub = contact.activity['subactivity'].strip()
+ activity_string += ' (%s)' % activity_sub
+ else:
+ activity_string += ''
+ 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()