Fix modelfilter regression. Renaming a group duplicated it.

Even make it work in merged accounts mode.
This commit is contained in:
Stephan Erb 2008-06-02 17:59:59 +00:00
parent 2bcb932d2e
commit fa48c480ff
1 changed files with 11 additions and 17 deletions

View File

@ -2596,23 +2596,17 @@ class RosterWindow:
for g in helpers.special_groups: for g in helpers.special_groups:
if g in (new_text, old_text): if g in (new_text, old_text):
return return
# get all contacts in that group # update all contacts in the given group
for jid in gajim.contacts.get_jid_list(account): if self.regroup:
contact = gajim.contacts.get_contact_with_highest_priority( accounts = gajim.connections.keys()
account, jid) else:
if old_text in contact.groups: accounts = [account,]
# set them in the new one and remove it from the old for acc in accounts:
contact.groups.remove(old_text) for jid in gajim.contacts.get_jid_list(acc):
self.remove_contact(contact.jid, account) contact = gajim.contacts.get_first_contact_from_jid(acc, jid)
if new_text not in contact.groups: if old_text in contact.groups:
contact.groups.append(new_text) self.remove_contact_from_groups(jid, acc, [old_text,])
self.add_contact(contact.jid, account) self.add_contact_to_groups(jid, acc, [new_text,])
gajim.connections[account].update_contact(contact.jid,
contact.name, contact.groups)
# If last removed iter was not visible, gajim.groups is not cleaned
if gajim.groups[account].has_key(old_text):
del gajim.groups[account][old_text]
self.draw_group(new_text, account)
def on_canceled(): def on_canceled():
if gajim.interface.instances.has_key('rename'): if gajim.interface.instances.has_key('rename'):