changeset 2848:b9da74c9d46e

quick_frontend(app): fixed use of bare jid for target when getting a new message: in newMessage handler, full jid was sometime used for target, while is should always be bare jid. Full jid is used in the messageNew method of each widget.
author Goffi <goffi@goffi.org>
date Sun, 10 Mar 2019 18:02:56 +0100 (2019-03-10)
parents c055a3a4ecb0
children c2858e63cd82
files sat_frontends/quick_frontend/quick_app.py
diffstat 1 files changed, 7 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Sun Mar 10 18:02:54 2019 +0100
+++ b/sat_frontends/quick_frontend/quick_app.py	Sun Mar 10 18:02:56 2019 +0100
@@ -702,32 +702,24 @@
         from_jid = jid.JID(from_jid_s)
         to_jid = jid.JID(to_jid_s)
         if not self.trigger.point(
-            "messageNewTrigger",
-            uid,
-            timestamp,
-            from_jid,
-            to_jid,
-            msg,
-            subject,
-            type_,
-            extra,
-            profile=profile,
-        ):
+            "messageNewTrigger", uid, timestamp, from_jid, to_jid, msg, subject, type_,
+            extra, profile=profile,):
             return
 
         from_me = from_jid.bare == self.profiles[profile].whoami.bare
-        target = to_jid if from_me else from_jid
+        mess_to_jid = to_jid if from_me else from_jid
+        target = mess_to_jid.bare
         contact_list = self.contact_lists[profile]
 
         try:
-            is_room = contact_list.isRoom(target.bare)
+            is_room = contact_list.isRoom(target)
         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
+            target = target
         # we want to be sure to have at least one QuickChat instance
         self.widgets.getOrCreateWidget(
             quick_chat.QuickChat,
@@ -750,7 +742,7 @@
             quick_chat.QuickChat, target=target, profiles=(profile,)
         ):
             widget.messageNew(
-                uid, timestamp, from_jid, target, msg, subject, type_, extra, profile
+                uid, timestamp, from_jid, mess_to_jid, msg, subject, type_, extra, profile
             )
 
     def messageEncryptionStartedHandler(self, destinee_jid_s, plugin_data, profile):