changeset 577:e1a773a64fb6

browser_side: fixes the display of MUC occupants presences
author souliane <souliane@mailoo.org>
date Sat, 18 Oct 2014 14:47:47 +0200
parents daa9be94e88f
children 668bb04e9708
files src/browser/libervia_main.py src/browser/sat_browser/base_panels.py src/browser/sat_browser/panels.py
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Fri Oct 17 20:38:38 2014 +0200
+++ b/src/browser/libervia_main.py	Sat Oct 18 14:47:47 2014 +0200
@@ -767,14 +767,15 @@
                 self.status_panel.setStatus(statuses.values()[0])  # pylint: disable=E1103
         else:
             if entity_jid.bare in self.room_list:
-                wid = self.getLiberviaWidget(panels.ChatPanel, {'item': entity_jid}, ignoreOtherTabs=False)
+                wid = self.getLiberviaWidget(panels.ChatPanel, {'item': entity_jid, 'type_': 'group'}, ignoreOtherTabs=False)
             else:
                 wid = self.contact_panel
                 if show == 'unavailable':  # XXX: save some resources as for now we only need 'unavailable'
                     for plugin in self.plugins.values():
                         if hasattr(plugin, 'presenceReceivedTrigger'):
                             plugin.presenceReceivedTrigger(entity_jid, show, priority, statuses)
-            wid.setConnected(entity_jid.bare, entity_jid.resource, show, priority, statuses)
+            if wid:
+                wid.setConnected(entity_jid.bare, entity_jid.resource, show, priority, statuses)
 
     def _roomJoinedCb(self, room_jid, room_nicks, user_nick):
         _target = jid.JID(room_jid)
--- a/src/browser/sat_browser/base_panels.py	Fri Oct 17 20:38:38 2014 +0200
+++ b/src/browser/sat_browser/base_panels.py	Sat Oct 18 14:47:47 2014 +0200
@@ -128,7 +128,10 @@
 
         @return: Occupant
         """
-        return self.occupants_list[nick]
+        try:
+            return self.occupants_list[nick]
+        except KeyError:
+            return None
 
     def clear(self):
         self.occupants_list.clear()
--- a/src/browser/sat_browser/panels.py	Fri Oct 17 20:38:38 2014 +0200
+++ b/src/browser/sat_browser/panels.py	Sat Oct 18 14:47:47 2014 +0200
@@ -1359,7 +1359,9 @@
         assert(jid_s == self.target.bare)
         if self.type != 'group':
             return
-        contact.setPresenceStyle(self.occupants_list.getOccupantBox(resource), availability)
+        box = self.occupants_list.getOccupantBox(resource)
+        if box:
+            contact.setPresenceStyle(box, availability)
 
 
 class WebPanel(base_widget.LiberviaWidget):