Activity and Mood in tooltips now bug-free (:P)
This commit is contained in:
parent
ab26867fb2
commit
4f68782ec7
|
@ -1,18 +1,20 @@
|
||||||
from common import gajim, xmpp
|
from common import gajim, xmpp
|
||||||
|
|
||||||
def user_mood(items, name, jid):
|
def user_mood(items, name, jid):
|
||||||
#FIXME: text deletion
|
|
||||||
(user, resource) = gajim.get_room_and_nick_from_fjid(jid)
|
(user, resource) = gajim.get_room_and_nick_from_fjid(jid)
|
||||||
contacts = gajim.contacts.get_contact(name, user, resource=resource)
|
contacts = gajim.contacts.get_contact(name, user, resource=resource)
|
||||||
for item in items.getTags('item'):
|
for item in items.getTags('item'):
|
||||||
child = item.getTag('mood')
|
child = item.getTag('mood')
|
||||||
if child is not None:
|
if child is not None:
|
||||||
for ch in child.getChildren():
|
for contact in contacts:
|
||||||
if ch.getName() != 'text':
|
if contact.mood.has_key('mood'):
|
||||||
for contact in contacts:
|
del contact.mood['mood']
|
||||||
|
if contact.mood.has_key('text'):
|
||||||
|
del contact.mood['text']
|
||||||
|
for ch in child.getChildren():
|
||||||
|
if ch.getName() != 'text':
|
||||||
contact.mood['mood'] = ch.getName()
|
contact.mood['mood'] = ch.getName()
|
||||||
else:
|
else:
|
||||||
for contact in contacts:
|
|
||||||
contact.mood['text'] = ch.getData()
|
contact.mood['text'] = ch.getData()
|
||||||
|
|
||||||
def user_tune(items, name, jid):
|
def user_tune(items, name, jid):
|
||||||
|
@ -22,21 +24,24 @@ def user_geoloc(items, name, jid):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def user_activity(items, name, jid):
|
def user_activity(items, name, jid):
|
||||||
#FIXME: text deletion
|
|
||||||
(user, resource) = gajim.get_room_and_nick_from_fjid(jid)
|
(user, resource) = gajim.get_room_and_nick_from_fjid(jid)
|
||||||
contacts = gajim.contacts.get_contact(name, user, resource=resource)
|
contacts = gajim.contacts.get_contact(name, user, resource=resource)
|
||||||
for item in items.getTags('item'):
|
for item in items.getTags('item'):
|
||||||
child = item.getTag('activity')
|
child = item.getTag('activity')
|
||||||
if child is not None:
|
if child is not None:
|
||||||
for ch in child.getChildren():
|
for contact in contacts:
|
||||||
if ch.getName() != 'text':
|
if contact.activity.has_key('activity'):
|
||||||
for contact in contacts:
|
del contact.activity['activity']
|
||||||
|
if contact.activity.has_key('subactivity'):
|
||||||
|
del contact.activity['subactivity']
|
||||||
|
if contact.activity.has_key('text'):
|
||||||
|
del contact.activity['text']
|
||||||
|
for ch in child.getChildren():
|
||||||
|
if ch.getName() != 'text':
|
||||||
contact.activity['activity'] = ch.getName()
|
contact.activity['activity'] = ch.getName()
|
||||||
for chi in ch.getChildren():
|
for chi in ch.getChildren():
|
||||||
for contact in contacts:
|
|
||||||
contact.activity['subactivity'] = chi.getName()
|
contact.activity['subactivity'] = chi.getName()
|
||||||
else:
|
else:
|
||||||
for contact in contacts:
|
|
||||||
contact.activity['text'] = ch.getData()
|
contact.activity['text'] = ch.getData()
|
||||||
|
|
||||||
def user_send_mood(account, mood, message = ''):
|
def user_send_mood(account, mood, message = ''):
|
||||||
|
|
|
@ -479,13 +479,10 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
# we append show below
|
# we append show below
|
||||||
|
|
||||||
if contact.mood.has_key('mood'):
|
if contact.mood.has_key('mood'):
|
||||||
mood = contact.mood['mood'].strip()
|
mood_string = 'Mood: <b>%s</b>' % contact.mood['mood'].strip()
|
||||||
if contact.mood.has_key('text'):
|
if contact.mood.has_key('text') and contact.mood['text'] != '':
|
||||||
mood_text = contact.mood['text'].strip()
|
mood_string += ' (%s)' % contact.mood['text'].strip()
|
||||||
else:
|
properties.append((mood_string, None))
|
||||||
mood_text = ''
|
|
||||||
if mood:
|
|
||||||
properties.append(('Mood: <b>%s</b> (%s)' % (mood, mood_text), None))
|
|
||||||
|
|
||||||
if contact.activity.has_key('activity'):
|
if contact.activity.has_key('activity'):
|
||||||
activity = contact.activity['activity'].strip()
|
activity = contact.activity['activity'].strip()
|
||||||
|
|
Loading…
Reference in New Issue