From bab9d1625b27d6622b5566937488172df8e58ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Tue, 20 Nov 2018 13:20:17 +0000 Subject: omemo: catch xep_0384.MissingOwnKey exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugins/omemo_plugin.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/omemo_plugin.py b/plugins/omemo_plugin.py index 4d3eabec..efd64722 100644 --- a/plugins/omemo_plugin.py +++ b/plugins/omemo_plugin.py @@ -15,7 +15,10 @@ import textwrap from poezio.plugin import BasePlugin from poezio.tabs import ConversationTab from poezio.xdg import CACHE_HOME +from slixmpp.plugins.xep_0384.plugin import MissingOwnKey +import logging +log = logging.getLogger(__name__) class Plugin(BasePlugin): def init(self): @@ -122,7 +125,10 @@ class Plugin(BasePlugin): self.info('Foo2') if self.xmpp['xep_0384'].is_encrypted(message): - body = self.xmpp['xep_0384'].decrypt_message(message) - if body is None: # Message wasn't decrypted + try: + body = self.xmpp['xep_0384'].decrypt_message(message) + except (MissingOwnKey,): + log.debug("The following message is missing our key;" + "Couldn't decrypt: %r", message) return None message['body'] = body.decode("utf8") -- cgit v1.2.3