From 93ac4db950a8367bfdc06d76bde43b023eef77f0 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 10 Mar 2019 18:02:56 +0100 Subject: [PATCH] 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. --- sat_frontends/quick_frontend/quick_app.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/sat_frontends/quick_frontend/quick_app.py b/sat_frontends/quick_frontend/quick_app.py index 5bc568d0..f863932e 100644 --- a/sat_frontends/quick_frontend/quick_app.py +++ b/sat_frontends/quick_frontend/quick_app.py @@ -702,32 +702,24 @@ class QuickApp(object): 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 @@ class QuickApp(object): 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):