changeset 1339:18cd46a264e9 frontends_multi_profiles

quick frontends, primitivus: fixed listener calls (kwargs where forgotten) + fixed presence listener + renamed updatePresence to onPresenceUpdate for consistency with oter listeners
author Goffi <goffi@goffi.org>
date Tue, 24 Feb 2015 16:52:44 +0100
parents 139263ee85c5
children 91e72da1d093
files frontends/src/primitivus/contact_list.py frontends/src/quick_frontend/quick_app.py frontends/src/quick_frontend/quick_contact_list.py
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/contact_list.py	Tue Feb 24 14:40:19 2015 +0100
+++ b/frontends/src/primitivus/contact_list.py	Tue Feb 24 16:52:44 2015 +0100
@@ -148,8 +148,8 @@
         self.update()
         self._emit('click', entity)
 
-    def updatePresence(self, entity, show, priority, statuses):
-        super(ContactList, self).updatePresence(entity, show, priority, statuses)
+    def onPresenceUpdate(self, entity, show, priority, statuses, profile):
+        super(ContactList, self).onPresenceUpdate(entity, show, priority, statuses, profile)
         self.update()
 
     # Methods to build the widget
--- a/frontends/src/quick_frontend/quick_app.py	Tue Feb 24 14:40:19 2015 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Tue Feb 24 16:52:44 2015 +0100
@@ -349,7 +349,7 @@
             profile = kwargs.get("profile")
             for listener, profiles_filter in listeners.iteritems():
                 if profile is None or not profiles_filter or profile in profiles_filter:
-                    listener(*args)
+                    listener(*args, **kwargs)
 
     def check_profile(self, profile):
         """Tell if the profile is currently followed by the application"""
--- a/frontends/src/quick_frontend/quick_contact_list.py	Tue Feb 24 14:40:19 2015 +0100
+++ b/frontends/src/quick_frontend/quick_contact_list.py	Tue Feb 24 16:52:44 2015 +0100
@@ -73,7 +73,7 @@
         self.host.bridge.asyncGetParamA(C.SHOW_OFFLINE_CONTACTS, "General", profile_key=profile, callback=self._showOfflineContacts)
 
         # FIXME: workaround for a pyjamas issue: calling hash on a class method always return a different value if that method is defined directly within the class (with the "def" keyword)
-        self.presenceListener = self.updatePresence
+        self.presenceListener = self.onPresenceUpdate
         self.host.addListener('presence', self.presenceListener, [profile])
 
     def __contains__(self, entity):
@@ -367,13 +367,14 @@
             set_.difference_update(to_remove)
         self.update()
 
-    def updatePresence(self, entity, show, priority, statuses):
+    def onPresenceUpdate(self, entity, show, priority, statuses, profile):
         """Update entity's presence status
 
-        @param entity(jid.JID): entity to update's entity
+        @param entity(jid.JID): entity updated
         @param show: availability
         @parap priority: resource's priority
         @param statuses: dict of statuses
+        @param profile: %(doc_profile)s
         """
         cache = self.getCache(entity)
         if show == C.PRESENCE_UNAVAILABLE: