diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2019-08-22 22:18:58 +0200 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2019-12-27 18:57:33 +0100 |
commit | 50833050c777b08f08d2fd22a19987814b8634eb (patch) | |
tree | caecb516a56c49fce5da266471ce78eaf5c41e9a | |
parent | 7609a56e4820906efee6792bbee12267060ef6c0 (diff) | |
download | poezio-50833050c777b08f08d2fd22a19987814b8634eb.tar.gz poezio-50833050c777b08f08d2fd22a19987814b8634eb.tar.bz2 poezio-50833050c777b08f08d2fd22a19987814b8634eb.tar.xz poezio-50833050c777b08f08d2fd22a19987814b8634eb.zip |
omemo: handle async encryption methods
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r-- | poezio/plugin_e2ee.py | 8 |
1 files changed, 7 insertions, 1 deletions
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. |