quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
This commit is contained in:
parent
9461ac75ce
commit
cf58422fcc
1 changed files with 24 additions and 3 deletions
|
|
@ -91,17 +91,27 @@ class QuickContactList(QuickWidget):
|
|||
"""
|
||||
return self._roster
|
||||
|
||||
@property
|
||||
def roster_entities_connected(self):
|
||||
"""Return all the bare JIDs of the roster entities that are connected.
|
||||
|
||||
@return: set(jid.JID)
|
||||
"""
|
||||
return set([entity for entity in self._roster if self.getCache(entity, C.PRESENCE_SHOW) is not None])
|
||||
|
||||
@property
|
||||
def roster_entities_by_group(self):
|
||||
"""Return a dictionary binding the roster groups to their entities bare JIDs.
|
||||
"""Return a dictionary binding the roster groups to their entities bare
|
||||
JIDs. This also includes the empty group (None key).
|
||||
|
||||
@return: dict{unicode: set(jid.JID)}
|
||||
"""
|
||||
return {group: self._groups[group]['jids'] for group in self._groups}
|
||||
|
||||
@property
|
||||
def roster_groups_by_entity(self, contact_jid_s):
|
||||
"""Return a dictionary binding the entities bare JIDs to their roster groups.
|
||||
def roster_groups_by_entity(self):
|
||||
"""Return a dictionary binding the entities bare JIDs to their roster
|
||||
groups. The empty group is filtered out.
|
||||
|
||||
@return: dict{jid.JID: set(unicode)}
|
||||
"""
|
||||
|
|
@ -197,6 +207,17 @@ class QuickContactList(QuickWidget):
|
|||
assert special_type in C.CONTACT_SPECIAL_ALLOWED + (None,)
|
||||
self.setCache(entity, C.CONTACT_SPECIAL, special_type)
|
||||
|
||||
def getSpecials(self, special_type=None):
|
||||
"""Return all the bare JIDs of the special roster entities of the type
|
||||
specified by special_type. If special_type is None, return all specials.
|
||||
|
||||
@param special_type: one of special type (e.g. C.CONTACT_SPECIAL_GROUP) or None to return all specials.
|
||||
@return: set(jid.JID)
|
||||
"""
|
||||
if special_type is None:
|
||||
return self._specials
|
||||
return set([entity for entity in self._specials if self.getCache(entity, C.CONTACT_SPECIAL) == special_type])
|
||||
|
||||
def clearContacts(self):
|
||||
"""Clear all the contact list"""
|
||||
self.unselectAll()
|
||||
|
|
|
|||
Loading…
Reference in a new issue