Buggy. Don\'t touch
This commit is contained in:
parent
512db7618b
commit
149b0fcdef
4 changed files with 34 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue