diff src/browser/sat_browser/contact_list.py @ 624:9092e624bb27 frontends_multi_profiles

browser_side: fixes various issues
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 21:51:20 +0100
parents 2c41ce0c3b3f
children 7113d40533d6
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Sun Feb 22 21:42:14 2015 +0100
+++ b/src/browser/sat_browser/contact_list.py	Sun Feb 22 21:51:20 2015 +0100
@@ -352,7 +352,10 @@
         self.add(self.scroll_panel)
         self.setStyleName('contactList')
         Window.addWindowResizeListener(self)
-        host.addListener('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):
@@ -360,7 +363,7 @@
 
     def onDelete(self):
         QuickContactList.onDelete(self)
-        self.host.removeListener('avatar', self.onAvatarUpdate)
+        self.host.removeListener('avatar', self.avatarListener)
 
     def update(self):
         ### GROUPS ###
@@ -473,10 +476,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):
@@ -557,12 +556,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_))