quick frontends, primitivus: fixed listener calls (kwargs where forgotten) + fixed presence listener + renamed updatePresence to onPresenceUpdate for consistency with oter listeners

This commit is contained in:
Goffi 2015-02-24 16:52:44 +01:00
commit d1dad92f8c
3 changed files with 7 additions and 6 deletions

View file

@ -148,8 +148,8 @@ class ContactList(PrimitivusWidget, QuickContactList):
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

View file

@ -349,7 +349,7 @@ class QuickApp(object):
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"""

View file

@ -73,7 +73,7 @@ class QuickContactList(QuickWidget):
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 @@ class QuickContactList(QuickWidget):
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: