summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2021-07-18 00:16:07 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2022-03-16 08:09:11 +0100
commitc4ce439483db6fe82b38e30ea8105009005e1184 (patch)
tree7a9d1779b16116f39b464db81f83795ebb67c5ec
parentccf9c3e4e1e6cfdfcd37d340df60f99c95a8a753 (diff)
downloadpoezio-c4ce439483db6fe82b38e30ea8105009005e1184.tar.gz
poezio-c4ce439483db6fe82b38e30ea8105009005e1184.tar.bz2
poezio-c4ce439483db6fe82b38e30ea8105009005e1184.tar.xz
poezio-c4ce439483db6fe82b38e30ea8105009005e1184.zip
plugin_e2ee: allow normal message to pass through again when not encrypting
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/plugin_e2ee.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py
index 673ea728..a1ea1f9e 100644
--- a/poezio/plugin_e2ee.py
+++ b/poezio/plugin_e2ee.py
@@ -505,6 +505,9 @@ class E2EEPlugin(BasePlugin):
has_body = message.xml.find('{%s}%s' % (JCLIENT_NS, 'body')) is not None
+ if not self._encryption_enabled(tab.jid):
+ raise NothingToEncrypt()
+
# Drop all messages that don't contain a body if the plugin doesn't do
# Stanza Encryption
if not self.stanza_encryption and not has_encrypted_tag and not has_body:
@@ -515,18 +518,14 @@ class E2EEPlugin(BasePlugin):
)
return None
- if tab and not has_encrypted_tag:
- if not self._encryption_enabled(tab.jid):
- raise NothingToEncrypt()
-
- # Call the enabled encrypt method
- func = self._enabled_tabs[tab.jid]
- if iscoroutinefunction(func):
- # pylint: disable=unexpected-keyword-arg
- await func(message, jids, tab, passthrough=True)
- else:
- # pylint: disable=unexpected-keyword-arg
- func(message, jids, tab, passthrough=True)
+ # Call the enabled encrypt method
+ func = self._enabled_tabs[tab.jid]
+ if iscoroutinefunction(func):
+ # pylint: disable=unexpected-keyword-arg
+ await func(message, jids, tab, passthrough=True)
+ else:
+ # pylint: disable=unexpected-keyword-arg
+ func(message, jids, tab, passthrough=True)
if has_body:
# Only add EME tag if the message has a body.