comparison frontends/src/quick_frontend/quick_contact_list.py @ 1297:ef7e8e23b353 frontends_multi_profiles

quick_frontend: add some properties for QuickContactList
author souliane <souliane@mailoo.org>
date Thu, 05 Feb 2015 12:10:42 +0100
parents faa1129559b8
children 3dc7f61677bb
comparison
equal deleted inserted replaced
1296:ebf72fe68d1c 1297:ef7e8e23b353
80 try: 80 try:
81 return entity.resource in self.getCache(entity.bare, C.CONTACT_RESOURCES) 81 return entity.resource in self.getCache(entity.bare, C.CONTACT_RESOURCES)
82 except KeyError: 82 except KeyError:
83 return False 83 return False
84 return entity in self._cache 84 return entity in self._cache
85
86 @property
87 def roster_entities(self):
88 """Return all the bare JIDs of the roster entities.
89
90 @return: set(jid.JID)
91 """
92 return self._roster
93
94 @property
95 def roster_entities_by_group(self):
96 """Return a dictionary binding the roster groups to their entities bare JIDs.
97
98 @return: dict{unicode: set(jid.JID)}
99 """
100 return {group: self._groups[group]['jids'] for group in self._groups}
101
102 @property
103 def roster_groups_by_entity(self, contact_jid_s):
104 """Return a dictionary binding the entities bare JIDs to their roster groups.
105
106 @return: dict{jid.JID: set(unicode)}
107 """
108 result = {}
109 for group, data in self._groups.iteritems():
110 if group is None:
111 continue
112 for entity in data['jids']:
113 result.setdefault(entity, set()).add(group)
114 return result
85 115
86 def fill(self): 116 def fill(self):
87 """Get all contacts from backend, and fill the widget""" 117 """Get all contacts from backend, and fill the widget"""
88 def gotContacts(contacts): 118 def gotContacts(contacts):
89 for contact in contacts: 119 for contact in contacts: