changeset 581:1c1dbe03d3c6

browser_side: fixes issue while getting a chat state for a MUC occupant who already left
author souliane <souliane@mailoo.org>
date Mon, 20 Oct 2014 10:00:44 +0200
parents 79fbc20c786b
children c6380dd30602
files src/browser/libervia_main.py src/browser/sat_browser/panels.py
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Sun Oct 19 12:32:08 2014 +0200
+++ b/src/browser/libervia_main.py	Mon Oct 20 10:00:44 2014 +0200
@@ -918,11 +918,8 @@
 
         for lib_wid in self.libervia_widgets:
             if isinstance(lib_wid, panels.ChatPanel):
-                if target == '@ALL' or target == lib_wid.target.bare:
-                    if lib_wid.type == 'one2one':
-                        lib_wid.setState(state)
-                    elif lib_wid.type == 'group':
-                        lib_wid.setState(state, nick=nick)
+                if target == '@ALL@' or lib_wid.matchEntity(target):
+                    lib_wid.setState(state, nick=nick)
 
     def _askConfirmation(self, confirmation_id, confirmation_type, data):
         answer_data = {}
--- a/src/browser/sat_browser/panels.py	Sun Oct 19 12:32:08 2014 +0200
+++ b/src/browser/sat_browser/panels.py	Mon Oct 20 10:00:44 2014 +0200
@@ -1335,13 +1335,15 @@
         @param state: the new chat state
         @param nick: None for one2one, the MUC user nick or ALL_OCCUPANTS
         """
-        if nick:
-            assert(self.type == 'group')
-            occupants = self.occupants_list.occupants_list.keys() if nick == C.ALL_OCCUPANTS else [nick]
+        if self.type == 'group':
+            assert(nick)
+            if nick == C.ALL_OCCUPANTS:
+                occupants = self.occupants_list.occupants_list.keys()
+            else:
+                occupants = [nick] if nick in self.occupants_list.occupants_list else []
             for occupant in occupants:
                 self.occupants_list.occupants_list[occupant].setState(state)
         else:
-            assert(self.type == 'one2one')
             self._state = state
             self.refreshTitle()
         self.state_machine.started = not not state  # start to send "composing" state from now