summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-06-06 16:26:08 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2019-07-01 19:42:45 +0200
commita0140388f34a6d0eb012c1508e67651ab09fa345 (patch)
tree70925f0f23e5a9c11a6c625f3c71259f1657287c
parent47909c4dcfe005191f16e40c1a29ac5d9b425fcc (diff)
downloadpoezio-a0140388f34a6d0eb012c1508e67651ab09fa345.tar.gz
poezio-a0140388f34a6d0eb012c1508e67651ab09fa345.tar.bz2
poezio-a0140388f34a6d0eb012c1508e67651ab09fa345.tar.xz
poezio-a0140388f34a6d0eb012c1508e67651ab09fa345.zip
e2ee api: Avoid creating EME tag when looking if it's present
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 <pep@bouah.net>
-rw-r--r--poezio/plugin_e2ee.py5
1 files changed, 4 insertions, 1 deletions
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: