diff frontends/src/quick_frontend/quick_contact_management.py @ 347:ea3e1b82dd79

core: contact deletion from roster if we have no subscription to it (behaviour may change in futur) quick frontend: groups is updated in contactList in case of roster push
author Goffi <goffi@goffi.org>
date Sun, 29 May 2011 16:12:08 +0200
parents b1794cbb88e5
children cf005701624b
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_management.py	Sat May 28 20:28:21 2011 +0200
+++ b/frontends/src/quick_frontend/quick_contact_management.py	Sun May 29 16:12:08 2011 +0200
@@ -31,6 +31,9 @@
     def __init__(self):
         self.__contactlist = {}
 
+    def __contains__(self, entity):
+        return entity.short in self.__contactlist
+
     def clear(self):
         """Clear all the contact list"""
         self.__contactlist.clear()
@@ -39,6 +42,8 @@
         """Add contact to the list, update resources"""
         if not self.__contactlist.has_key(entity.short):
             self.__contactlist[entity.short] = {'resources':[]}
+        if not entity.resource:
+            return
         if entity.resource in self.__contactlist[entity.short]['resources']:
             self.__contactlist[entity.short]['resources'].remove(entity.resource)
         self.__contactlist[entity.short]['resources'].append(entity.resource)