omemo: handle async encryption methods

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-22 22:18:58 +02:00
parent 7609a56e48
commit 50833050c7

View file

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