From b505c371b00de8dc292853aa9bc9a8ddd4c87536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 2 Jan 2022 10:41:35 +0100 Subject: [PATCH] plugin_e2ee: encrypt: also search tabs for barejids if not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/plugin_e2ee.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index 46a7e38f..e3c32f94 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -442,10 +442,15 @@ class E2EEPlugin(BasePlugin): # MUCs). Let the plugin decide what to do with this information. jids: Optional[List[JID]] = [message['to']] tab = self.core.tabs.by_jid(message['to']) - if tab is None: # When does that ever happen? - log.debug('Attempting to encrypt a message to \'%s\' ' - 'that is not attached to a Tab. ?! Aborting ' - 'encryption.', message['to']) + if tab is None and message['to'].resource: + # Redo the search with the bare JID + tab = self.core.tabs.by_jid(message['to'].bare) + + if tab is None: # Possible message sent directly by the e2ee lib? + log.debug( + 'A message we do not have a tab for ' + 'is being sent to \'%s\'. Abort.', message['to'], + ) return None parent = None