diff src/browser/sat_browser/contact_list.py @ 637:7113d40533d6 frontends_multi_profiles

merged souliane changes
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:47:27 +0100
parents 16a5da120b7f 9092e624bb27
children 63697f082e8a
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Mon Feb 23 18:44:58 2015 +0100
+++ b/src/browser/sat_browser/contact_list.py	Mon Feb 23 18:47:27 2015 +0100
@@ -358,7 +358,10 @@
         self.add(self.scroll_panel)
         self.setStyleName('contactList')
         Window.addWindowResizeListener(self)
-        host.addListerner('avatar', self.onAvatarUpdate)
+
+        # 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.avatarListener = self.onAvatarUpdate
+        host.addListener('avatar', self.avatarListener, [C.PROF_KEY_NONE])
 
     @property
     def profile(self):
@@ -366,7 +369,7 @@
 
     def onDelete(self):
         QuickContactList.onDelete(self)
-        self.host.removeListener('avatar', self.onAvatarUpdate)
+        self.host.removeListener('avatar', self.avatarListener)
 
     def update(self):
         ### GROUPS ###
@@ -477,10 +480,6 @@
     #         # case 2: update (or confirm) with the values of the resource which takes precedence
     #         self._contacts_panel.setState(jid_s, "availability", availability)
 
-    #     # update the connected contacts chooser live
-    #     if hasattr(self.host, "room_contacts_chooser") and self.host.room_contacts_chooser is not None:
-    #         self.host.room_contacts_chooser.resetContacts()
-
     #     self.updateVisibility([jid_s], self.getContactGroups(jid_s))
 
     def setContactMessageWaiting(self, jid, waiting):
@@ -563,12 +562,11 @@
         """
         self._contacts_panel.updateAvatar(jid_s, url)
 
-    def onAvatarUpdate(self, jid_, hash_, profile):
+    def onAvatarUpdate(self, jid_, hash_):
         """Called on avatar update events
 
         @param jid_: jid of the entity with updated avatar
         @param hash_: hash of the avatar
-        @param profile: should be C.PROF_KEY_NONE
         """
         self._contacts_panel.updateAvatar(jid_, self.host.getAvatarURL(jid_))