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>
This commit is contained in:
Maxime “pep” Buquet 2019-06-06 16:26:08 +02:00
parent 47909c4dcf
commit a0140388f3

View file

@ -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: