fix new contacts API in pep

This commit is contained in:
Yann Leboulanger 2007-08-09 15:54:16 +00:00
parent 853448943b
commit a18e21c476

View file

@ -2,11 +2,12 @@ from common import gajim, xmpp
def user_mood(items, name, jid): def user_mood(items, name, jid):
(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) contact = gajim.contacts.get_contact(name, user, resource=resource)
if not contact:
return
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 contact in contacts:
if contact.mood.has_key('mood'): if contact.mood.has_key('mood'):
del contact.mood['mood'] del contact.mood['mood']
if contact.mood.has_key('text'): if contact.mood.has_key('text'):
@ -19,11 +20,12 @@ def user_mood(items, name, jid):
def user_tune(items, name, jid): def user_tune(items, name, jid):
(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) contact = gajim.contacts.get_contact(name, user, resource=resource)
if not contact:
return
for item in items.getTags('item'): for item in items.getTags('item'):
child = item.getTag('tune') child = item.getTag('tune')
if child is not None: if child is not None:
for contact in contacts:
if contact.tune.has_key('artist'): if contact.tune.has_key('artist'):
del contact.tune['artist'] del contact.tune['artist']
if contact.tune.has_key('title'): if contact.tune.has_key('title'):
@ -51,11 +53,12 @@ def user_geoloc(items, name, jid):
def user_activity(items, name, jid): def user_activity(items, name, jid):
(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) contact = gajim.contacts.get_contact(name, user, resource=resource)
if not contact:
return
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 contact in contacts:
if contact.activity.has_key('activity'): if contact.activity.has_key('activity'):
del contact.activity['activity'] del contact.activity['activity']
if contact.activity.has_key('subactivity'): if contact.activity.has_key('subactivity'):