Activity and Mood in tooltips now bug-free (:P)

This commit is contained in:
Piotr Gaczkowski 2007-03-30 23:24:12 +00:00
parent ab26867fb2
commit 4f68782ec7
2 changed files with 23 additions and 21 deletions

View File

@ -1,18 +1,20 @@
from common import gajim, xmpp
def user_mood(items, name, jid):
#FIXME: text deletion
(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:
for contact in contacts:
if contact.mood.has_key('mood'):
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()
else:
for contact in contacts:
else:
contact.mood['text'] = ch.getData()
def user_tune(items, name, jid):
@ -22,21 +24,24 @@ def user_geoloc(items, name, jid):
pass
def user_activity(items, name, jid):
#FIXME: text deletion
(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:
for contact in contacts:
if contact.activity.has_key('activity'):
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()
for chi in ch.getChildren():
for contact in contacts:
for chi in ch.getChildren():
contact.activity['subactivity'] = chi.getName()
else:
for contact in contacts:
else:
contact.activity['text'] = ch.getData()
def user_send_mood(account, mood, message = ''):

View File

@ -479,13 +479,10 @@ class RosterTooltip(NotificationAreaTooltip):
# we append show below
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(('Mood: <b>%s</b> (%s)' % (mood, mood_text), None))
mood_string = 'Mood: <b>%s</b>' % contact.mood['mood'].strip()
if contact.mood.has_key('text') and contact.mood['text'] != '':
mood_string += ' (%s)' % contact.mood['text'].strip()
properties.append((mood_string, None))
if contact.activity.has_key('activity'):
activity = contact.activity['activity'].strip()