comparison frontends/src/quick_frontend/quick_contact_list.py @ 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 f29beedb33b0
children e31a07a5614d
comparison
equal deleted inserted replaced
1338:139263ee85c5 1339:18cd46a264e9
71 # TODO: this may lead to two successive UI refresh and needs an optimization 71 # TODO: this may lead to two successive UI refresh and needs an optimization
72 self.host.bridge.asyncGetParamA(C.SHOW_EMPTY_GROUPS, "General", profile_key=profile, callback=self._showEmptyGroups) 72 self.host.bridge.asyncGetParamA(C.SHOW_EMPTY_GROUPS, "General", profile_key=profile, callback=self._showEmptyGroups)
73 self.host.bridge.asyncGetParamA(C.SHOW_OFFLINE_CONTACTS, "General", profile_key=profile, callback=self._showOfflineContacts) 73 self.host.bridge.asyncGetParamA(C.SHOW_OFFLINE_CONTACTS, "General", profile_key=profile, callback=self._showOfflineContacts)
74 74
75 # 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) 75 # 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)
76 self.presenceListener = self.updatePresence 76 self.presenceListener = self.onPresenceUpdate
77 self.host.addListener('presence', self.presenceListener, [profile]) 77 self.host.addListener('presence', self.presenceListener, [profile])
78 78
79 def __contains__(self, entity): 79 def __contains__(self, entity):
80 """Check if entity is in contact list 80 """Check if entity is in contact list
81 81
365 if set_entity.bare == entity.bare: 365 if set_entity.bare == entity.bare:
366 to_remove.add(set_entity) 366 to_remove.add(set_entity)
367 set_.difference_update(to_remove) 367 set_.difference_update(to_remove)
368 self.update() 368 self.update()
369 369
370 def updatePresence(self, entity, show, priority, statuses): 370 def onPresenceUpdate(self, entity, show, priority, statuses, profile):
371 """Update entity's presence status 371 """Update entity's presence status
372 372
373 @param entity(jid.JID): entity to update's entity 373 @param entity(jid.JID): entity updated
374 @param show: availability 374 @param show: availability
375 @parap priority: resource's priority 375 @parap priority: resource's priority
376 @param statuses: dict of statuses 376 @param statuses: dict of statuses
377 @param profile: %(doc_profile)s
377 """ 378 """
378 cache = self.getCache(entity) 379 cache = self.getCache(entity)
379 if show == C.PRESENCE_UNAVAILABLE: 380 if show == C.PRESENCE_UNAVAILABLE:
380 if not entity.resource: 381 if not entity.resource:
381 cache[C.CONTACT_RESOURCES].clear() 382 cache[C.CONTACT_RESOURCES].clear()