changeset 2032:d941fa9954f4

quick frontend (contact): fixed roster and roster_connected in handler + add a next function for pyjamas compatibility
author Goffi <goffi@goffi.org>
date Tue, 09 Aug 2016 01:10:09 +0200
parents 48a61879f9ef
children e3f1bd9dd009
files frontends/src/quick_frontend/quick_contact_list.py
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_list.py	Tue Aug 09 01:08:59 2016 +0200
+++ b/frontends/src/quick_frontend/quick_contact_list.py	Tue Aug 09 01:10:09 2016 +0200
@@ -41,6 +41,16 @@
         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 @@
         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