diff 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
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_list.py	Tue Feb 24 17:01:33 2015 +0100
+++ b/frontends/src/quick_frontend/quick_contact_list.py	Tue Feb 24 17:14:10 2015 +0100
@@ -75,6 +75,8 @@
         # 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.onPresenceUpdate
         self.host.addListener('presence', self.presenceListener, [profile])
+        self.nickListener = self.onNickUpdate
+        self.host.addListener('nick', self.nickListener, [profile])
 
     def __contains__(self, entity):
         """Check if entity is in contact list
@@ -399,6 +401,15 @@
             priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY])
             cache[C.CONTACT_MAIN_RESOURCE] = priority_resource
 
+    def onNickUpdate(self, entity, new_nick, profile):
+        """Update entity's nick
+
+        @param entity(jid.JID): entity updated
+        @param new_nick(unicode): new nick of the entity
+        @param profile: %(doc_profile)s
+        """
+        raise NotImplementedError # Must be implemented by frontends
+
     def unselectAll(self):
         """Unselect all contacts"""
         self._selected.clear()