Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_contact_list.py @ 1342:e31a07a5614d frontends_multi_profiles
quick_frontends, primitivus (contact list): added nick observer + implemented onNickUpdate
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 24 Feb 2015 17:14:10 +0100 |
parents | 18cd46a264e9 |
children | ec9e58357a07 |
comparison
equal
deleted
inserted
replaced
1341:6dbeb2ef966c | 1342:e31a07a5614d |
---|---|
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.onPresenceUpdate | 76 self.presenceListener = self.onPresenceUpdate |
77 self.host.addListener('presence', self.presenceListener, [profile]) | 77 self.host.addListener('presence', self.presenceListener, [profile]) |
78 self.nickListener = self.onNickUpdate | |
79 self.host.addListener('nick', self.nickListener, [profile]) | |
78 | 80 |
79 def __contains__(self, entity): | 81 def __contains__(self, entity): |
80 """Check if entity is in contact list | 82 """Check if entity is in contact list |
81 | 83 |
82 @param entity (jid.JID): jid of the entity (resource is not ignored, use bare jid if needed) | 84 @param entity (jid.JID): jid of the entity (resource is not ignored, use bare jid if needed) |
397 resource_data[C.PRESENCE_STATUSES] = statuses | 399 resource_data[C.PRESENCE_STATUSES] = statuses |
398 | 400 |
399 priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY]) | 401 priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY]) |
400 cache[C.CONTACT_MAIN_RESOURCE] = priority_resource | 402 cache[C.CONTACT_MAIN_RESOURCE] = priority_resource |
401 | 403 |
404 def onNickUpdate(self, entity, new_nick, profile): | |
405 """Update entity's nick | |
406 | |
407 @param entity(jid.JID): entity updated | |
408 @param new_nick(unicode): new nick of the entity | |
409 @param profile: %(doc_profile)s | |
410 """ | |
411 raise NotImplementedError # Must be implemented by frontends | |
412 | |
402 def unselectAll(self): | 413 def unselectAll(self): |
403 """Unselect all contacts""" | 414 """Unselect all contacts""" |
404 self._selected.clear() | 415 self._selected.clear() |
405 self.update() | 416 self.update() |
406 | 417 |