Fix modelfilter regression. Renaming a group duplicated it.
Even make it work in merged accounts mode.
This commit is contained in:
parent
2bcb932d2e
commit
fa48c480ff
|
@ -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:
|
||||||
|
accounts = [account,]
|
||||||
|
for acc in accounts:
|
||||||
|
for jid in gajim.contacts.get_jid_list(acc):
|
||||||
|
contact = gajim.contacts.get_first_contact_from_jid(acc, jid)
|
||||||
if old_text in contact.groups:
|
if old_text in contact.groups:
|
||||||
# set them in the new one and remove it from the old
|
self.remove_contact_from_groups(jid, acc, [old_text,])
|
||||||
contact.groups.remove(old_text)
|
self.add_contact_to_groups(jid, acc, [new_text,])
|
||||||
self.remove_contact(contact.jid, account)
|
|
||||||
if new_text not in contact.groups:
|
|
||||||
contact.groups.append(new_text)
|
|
||||||
self.add_contact(contact.jid, account)
|
|
||||||
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'):
|
||||||
|
|
Loading…
Reference in New Issue