From a0140388f34a6d0eb012c1508e67651ab09fa345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 6 Jun 2019 16:26:08 +0200 Subject: [PATCH] e2ee api: Avoid creating EME tag when looking if it's present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some slixmpp API fail.. it's be great if we didn't have to fiddle with the xml lib directly Signed-off-by: Maxime “pep” Buquet --- poezio/plugin_e2ee.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index c94f5ede..0a1080f2 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -26,6 +26,9 @@ ChatTabs = Union[ PrivateTab, ] +EME_NS = 'urn:xmpp:eme:0' +EME_TAG = 'encryption' + class E2EEPlugin(BasePlugin): """Interface for E2EE plugins""" @@ -118,7 +121,7 @@ class E2EEPlugin(BasePlugin): ) def _decrypt(self, message: Message, tab: ChatTabs) -> None: - if message['eme'] is None: + if message.xml.find('{%s}%s' % (EME_NS, EME_TAG)) is None: return None if message['eme']['namespace'] != self.eme_ns: