quick_frontend: remove the contact from the groups it has been removed from

This commit is contained in:
souliane 2015-02-06 19:31:13 +01:00
commit f0f097c106

View file

@ -236,6 +236,10 @@ class QuickContactList(QuickWidget):
if groups is not None:
if not groups:
groups = [None] # [None] is the default group
if C.CONTACT_GROUPS in cache:
# XXX: don't use set(cache[C.CONTACT_GROUPS]).difference(groups) because it won't work in Pyjamas if None is in cache[C.CONTACT_GROUPS]
for group in [group for group in cache[C.CONTACT_GROUPS] if group not in groups]:
self._groups[group]['jids'].remove(entity_bare)
cache[C.CONTACT_GROUPS] = groups
for group in groups:
self._groups.setdefault(group, {}).setdefault('jids', set()).add(entity_bare)