correctly add contacts to roster when we get a roster set <iq>, even in case we have a Contact instance already. Fixes #5595

This commit is contained in:
Yann Leboulanger 2010-03-25 07:50:32 +01:00
parent 2189ffdbc0
commit 0aca2d6a34
1 changed files with 5 additions and 10 deletions

View File

@ -1250,8 +1250,6 @@ class Interface:
gajim.contacts.add_contact(account, contact)
self.roster.add_contact(jid, account)
else:
# it is an existing contact that might has changed
re_place = False
# If contact has changed (sub, ask or group) update roster
# Mind about observer status changes:
# According to xep 0162, a contact is not an observer anymore when
@ -1259,7 +1257,6 @@ class Interface:
old_groups = contacts[0].groups
if contacts[0].sub != sub or contacts[0].ask != ask\
or old_groups != groups:
re_place = True
# c.get_shown_groups() has changed. Reflect that in
# roster_winodow
self.roster.remove_contact(jid, account, force=True)
@ -1268,13 +1265,11 @@ class Interface:
contact.sub = sub
contact.ask = ask
contact.groups = groups or []
if re_place:
self.roster.add_contact(jid, account)
# Refilter and update old groups
for group in old_groups:
self.roster.draw_group(group, account)
else:
self.roster.draw_contact(jid, account)
self.roster.add_contact(jid, account)
# Refilter and update old groups
for group in old_groups:
self.roster.draw_group(group, account)
self.roster.draw_contact(jid, account)
if self.remote_ctrl:
self.remote_ctrl.raise_signal('RosterInfo', (account, array))