handle nick changement in another resource. See #4826

This commit is contained in:
Yann Leboulanger 2009-02-19 09:34:27 +00:00
parent 3fab8db1b0
commit 3f5a2d9017

View file

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