quick frontend (contact): fixed roster and roster_connected in handler + add a next function for pyjamas compatibility
This commit is contained in:
parent
3f83911645
commit
40b71e6f80
1 changed files with 14 additions and 4 deletions
|
|
@ -41,6 +41,16 @@ except (TypeError, AttributeError): # Error raised is not the same depending on
|
|||
iter_cpy.sort(key=key)
|
||||
return pyjamas_max(iter_cpy)
|
||||
|
||||
# next doesn't exist in pyjamas
|
||||
def next(iterable, *args):
|
||||
try:
|
||||
return iterable.next()
|
||||
except StopIteration as e:
|
||||
if args:
|
||||
return args[0]
|
||||
raise e
|
||||
|
||||
|
||||
handler = None
|
||||
|
||||
|
||||
|
|
@ -596,25 +606,25 @@ class QuickContactListHandler(object):
|
|||
return False
|
||||
|
||||
@property
|
||||
def roster_entities(self):
|
||||
def roster(self):
|
||||
"""Return all the bare JIDs of the roster entities.
|
||||
|
||||
@return (set[jid.JID])
|
||||
"""
|
||||
entities = set()
|
||||
for contact_list in self._clist.itervalues():
|
||||
entities.update(contact_list.roster_entities)
|
||||
entities.update(contact_list.roster)
|
||||
return entities
|
||||
|
||||
@property
|
||||
def roster_entities_connected(self):
|
||||
def roster_connected(self):
|
||||
"""Return all the bare JIDs of the roster entities that are connected.
|
||||
|
||||
@return (set[jid.JID])
|
||||
"""
|
||||
entities = set()
|
||||
for contact_list in self._clist.itervalues():
|
||||
entities.update(contact_list.roster_entities_connected)
|
||||
entities.update(contact_list.roster_connected)
|
||||
return entities
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Reference in a new issue