diff sat_frontends/quick_frontend/quick_app.py @ 2792:441b536e28ed

quick frontend (chat): use right type in getOrCreateWidget on new message
author Goffi <goffi@goffi.org>
date Tue, 22 Jan 2019 18:52:16 +0100
parents 19ab67e28822
children 0b7ce5daee9b
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Sun Jan 20 18:20:55 2019 +0100
+++ b/sat_frontends/quick_frontend/quick_app.py	Tue Jan 22 18:52:16 2019 +0100
@@ -674,7 +674,13 @@
         from_me = from_jid.bare == self.profiles[profile].whoami.bare
         target = to_jid if from_me else from_jid
         contact_list = self.contact_lists[profile]
-        if target.resource and not contact_list.isRoom(target.bare):
+
+        try:
+            is_room = contact_list.isRoom(target.bare)
+        except exceptions.NotFound:
+            is_room = False
+
+        if target.resource and not is_room:
             # we avoid resource locking, but we must keep resource for private MUC
             # messages
             target = target.bare
@@ -682,9 +688,9 @@
         self.widgets.getOrCreateWidget(
             quick_chat.QuickChat,
             target,
-            type_=C.CHAT_ONE2ONE,
-            on_new_widget=None,
-            profile=profile,
+            type_ = C.CHAT_GROUP if is_room else C.CHAT_ONE2ONE,
+            on_new_widget = None,
+            profile = profile,
         )
 
         if (