From 40b71e6f80b492c93fde801c0aca7285021ceef2 Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 9 Aug 2016 01:10:09 +0200 Subject: [PATCH] quick frontend (contact): fixed roster and roster_connected in handler + add a next function for pyjamas compatibility --- .../src/quick_frontend/quick_contact_list.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py index 26772738..fff684d3 100644 --- a/frontends/src/quick_frontend/quick_contact_list.py +++ b/frontends/src/quick_frontend/quick_contact_list.py @@ -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