diff src/browser/sat_browser/contact.py @ 571:f0c8a4d51890

browser_side: print a warning when trying to access a non existing contact box: This occurs when you receive updatePresence of a MUC occupant before Libervia knows that this is a MUC. Actually you shouldn't receive presence update for the occupant before the MUC widget is displayed, this means a loss of information. One way to fix it is to modify (un)availableReceived in sat.core.xmpp: check for the entity data "type" or make a disco request if it doesn't exist, and an attribute to presenceUpdate to tell the frontend if we have a MUC occupant or a roster contact.
author souliane <souliane@mailoo.org>
date Fri, 17 Oct 2014 10:42:10 +0200
parents ee9c7bd266ad
children b07f0fe2763a
line wrap: on
line diff
--- a/src/browser/sat_browser/contact.py	Sat Oct 11 16:28:27 2014 +0200
+++ b/src/browser/sat_browser/contact.py	Fri Oct 17 10:42:10 2014 +0200
@@ -521,9 +521,15 @@
         @param groups (list[str]): list of groups
         """
         for jid_s in jids:
-            self._contact_list.getContactBox(jid_s).setVisible(jid_s in self.connected or self.offlineContactsToShow())
+            try:
+                self._contact_list.getContactBox(jid_s).setVisible(jid_s in self.connected or self.offlineContactsToShow())
+            except TypeError:
+                log.warning('No box for contact %s: this code line should not be reached' % jid_s)
         for group in groups:
-            self._groupList.getGroupBox(group).setVisible(self.hasVisibleMembers(group) or self.emtyGroupsToShow())
+            try:
+                self._groupList.getGroupBox(group).setVisible(self.hasVisibleMembers(group) or self.emtyGroupsToShow())
+            except TypeError:
+                log.warning('No box for group %s: this code line should not be reached' % group)
 
     def refresh(self):
         """Show or hide disconnected contacts and empty groups"""