fix add_contact_to_roster so it handles correctly sub-child contacts. Fixes #1650

This commit is contained in:
Yann Leboulanger 2006-03-06 12:24:04 +00:00
parent aa796665c5
commit 97183e141c
1 changed files with 6 additions and 3 deletions

View File

@ -195,7 +195,7 @@ class RosterWindow:
if not len(parent_iters): if not len(parent_iters):
# Add parent and children # Add parent and children
self.add_contact_to_roster(parent_contact.jid, account, True) self.add_contact_to_roster(parent_contact.jid, account, True)
return parent_iters = self.get_contact_iter(parent_contact.jid, account)
name = contact.get_shown_name() name = contact.get_shown_name()
for i in parent_iters: for i in parent_iters:
# we add some values here. see draw_contact for more # we add some values here. see draw_contact for more
@ -229,8 +229,11 @@ class RosterWindow:
# under this iter # under this iter
children_contacts = gajim.contacts.get_children_contacts(account, children_contacts = gajim.contacts.get_children_contacts(account,
contact) contact)
ccs = [] # children contacts that were relly in roster
for cc in children_contacts: for cc in children_contacts:
self.remove_contact(cc, account) if self.get_contact_iter(cc.jid, account):
self.remove_contact(cc, account)
ccs.append(cc)
groups = contact.groups groups = contact.groups
if observer: if observer:
groups = [_('Observers')] groups = [_('Observers')]
@ -267,7 +270,7 @@ class RosterWindow:
self.draw_contact(jid, account) self.draw_contact(jid, account)
self.draw_avatar(jid, account) self.draw_avatar(jid, account)
# put the children under this iter # put the children under this iter
for cc in children_contacts: for cc in ccs:
self.add_contact_to_roster(cc.jid, account) self.add_contact_to_roster(cc.jid, account)
def add_transport_to_roster(self, account, transport): def add_transport_to_roster(self, account, transport):