comparison 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
comparison
equal deleted inserted replaced
346:ca3a041fed30 347:ea3e1b82dd79
29 ### FIXME: is SàT a better place for all this stuff ??? ### 29 ### FIXME: is SàT a better place for all this stuff ??? ###
30 30
31 def __init__(self): 31 def __init__(self):
32 self.__contactlist = {} 32 self.__contactlist = {}
33 33
34 def __contains__(self, entity):
35 return entity.short in self.__contactlist
36
34 def clear(self): 37 def clear(self):
35 """Clear all the contact list""" 38 """Clear all the contact list"""
36 self.__contactlist.clear() 39 self.__contactlist.clear()
37 40
38 def add(self, entity): 41 def add(self, entity):
39 """Add contact to the list, update resources""" 42 """Add contact to the list, update resources"""
40 if not self.__contactlist.has_key(entity.short): 43 if not self.__contactlist.has_key(entity.short):
41 self.__contactlist[entity.short] = {'resources':[]} 44 self.__contactlist[entity.short] = {'resources':[]}
45 if not entity.resource:
46 return
42 if entity.resource in self.__contactlist[entity.short]['resources']: 47 if entity.resource in self.__contactlist[entity.short]['resources']:
43 self.__contactlist[entity.short]['resources'].remove(entity.resource) 48 self.__contactlist[entity.short]['resources'].remove(entity.resource)
44 self.__contactlist[entity.short]['resources'].append(entity.resource) 49 self.__contactlist[entity.short]['resources'].append(entity.resource)
45 50
46 def getContFromGroup(self, group): 51 def getContFromGroup(self, group):