Update for slixmpp-omemo update. API is now mostly async

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-12-26 19:31:09 +01:00
parent 7243414aa0
commit d6058156d9
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -116,7 +116,7 @@ class Plugin(E2EEPlugin):
if trust is not None
]
def decrypt(self, message: Message, jid: Optional[JID], tab: ChatTab) -> None:
async def decrypt(self, message: Message, jid: Optional[JID], tab: ChatTab) -> None:
if jid is None:
self.display_error('Unable to decrypt the message.')
return None
@ -133,7 +133,7 @@ class Plugin(E2EEPlugin):
body = None
try:
encrypted = message['omemo_encrypted']
body = self.core.xmpp['xep_0384'].decrypt_message(
body = await self.core.xmpp['xep_0384'].decrypt_message(
encrypted,
jid,
# Always decrypt. Let us handle how we then warn the user.
@ -209,7 +209,7 @@ class Plugin(E2EEPlugin):
# untrusted/undecided barejid, so we need to make a decision here.
# This is where you prompt your user to ask what to do. In
# this bot we will automatically trust undecided recipients.
self.core.xmpp['xep_0384'].trust(exn.bare_jid, exn.device, exn.ik)
await self.core.xmpp['xep_0384'].trust(exn.bare_jid, exn.device, exn.ik)
# TODO: catch NoEligibleDevicesException
except EncryptionPrepareException as exn:
log.debug('FOO: EncryptionPrepareException: %r', exn.errors)