changeset 1306:789e86a8919d frontends_multi_profiles

quick_frontend: remove the contact from the groups it has been removed from
author souliane <souliane@mailoo.org>
date Fri, 06 Feb 2015 19:31:13 +0100
parents 3dc7f61677bb
children 9512590dc3d7
files frontends/src/quick_frontend/quick_contact_list.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_list.py	Fri Feb 06 19:29:37 2015 +0100
+++ b/frontends/src/quick_frontend/quick_contact_list.py	Fri Feb 06 19:31:13 2015 +0100
@@ -236,6 +236,10 @@
         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)