we have to remove group from contact instances before removing them from roster so that gajim.groups in cleaned up. Fixes #1778

This commit is contained in:
Yann Leboulanger 2006-03-29 21:23:13 +00:00
parent 4849c2f815
commit e3fb6c2607
1 changed files with 4 additions and 2 deletions

View File

@ -2503,17 +2503,19 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
elif type == 'group':
# in C_JID column, we hold the group name (which is not escaped)
old_name = model[iter][C_JID].decode('utf-8')
# Groups may not change name from or to 'Not in Roster'
# Groups may not change name from or to 'Not in Roster' nor Transports
if _('Not in Roster') in (new_text, old_name):
return
if _('Transports') in (new_text, old_name):
return
# get all contacts in that group
for jid in gajim.contacts.get_jid_list(account):
contact = gajim.contacts.get_contact_with_highest_priority(account,
jid)
if old_name in contact.groups:
# set them in the new one and remove it from the old
self.remove_contact(contact, account)
contact.groups.remove(old_name)
self.remove_contact(contact, account)
contact.groups.append(new_text)
self.add_contact_to_roster(contact.jid, account)
gajim.connections[account].update_contact(contact.jid,