From 50833050c777b08f08d2fd22a19987814b8634eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 22 Aug 2019 22:18:58 +0200 Subject: omemo: handle async encryption methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/plugin_e2ee.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index e626f3ab..624a36f2 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -24,6 +24,8 @@ from slixmpp.xmlstream import StanzaBase from poezio.tabs import ConversationTab, DynamicConversationTab, StaticConversationTab, PrivateTab, MucTab from poezio.plugin import BasePlugin +from asyncio import iscoroutinefunction + import logging log = logging.getLogger(__name__) @@ -241,7 +243,11 @@ class E2EEPlugin(BasePlugin): return None # Call the enabled encrypt method - self._enabled_tabs[jid](message, tab) + func = self._enabled_tabs[jid] + if iscoroutinefunction(func): + await func(message, tab) + else: + func(message, tab) if has_body: # Only add EME tag if the message has a body. -- cgit v1.2.3