summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2022-01-02 10:41:35 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2022-03-01 20:44:07 +0100
commit5d5d6b7ed0d508015243c43c08650ffc1f6d4b33 (patch)
tree8c193c8e43c1ec36594ca74fd0cee0e6a3e97c6a
parent72ec3cd73bf884ce54603f9bf2a030285984ad4f (diff)
downloadpoezio-5d5d6b7ed0d508015243c43c08650ffc1f6d4b33.tar.gz
poezio-5d5d6b7ed0d508015243c43c08650ffc1f6d4b33.tar.bz2
poezio-5d5d6b7ed0d508015243c43c08650ffc1f6d4b33.tar.xz
poezio-5d5d6b7ed0d508015243c43c08650ffc1f6d4b33.zip
plugin_e2ee: encrypt: also search tabs for barejids if not found
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/plugin_e2ee.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py
index 0de203cc..b0d9ec8c 100644
--- a/poezio/plugin_e2ee.py
+++ b/poezio/plugin_e2ee.py
@@ -441,10 +441,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