Adapt example to new decrypt API

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-09-02 02:18:16 +02:00
parent 62b6037611
commit 79a4f417ed
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -17,7 +17,7 @@ import logging
from getpass import getpass from getpass import getpass
from argparse import ArgumentParser from argparse import ArgumentParser
from slixmpp import ClientXMPP from slixmpp import ClientXMPP, JID
from slixmpp.stanza import Message from slixmpp.stanza import Message
from slixmpp_omemo import PluginCouldNotLoad, MissingOwnKey, EncryptionPrepareException from slixmpp_omemo import PluginCouldNotLoad, MissingOwnKey, EncryptionPrepareException
from slixmpp_omemo import UndecidedException, UntrustedException, NoAvailableSession from slixmpp_omemo import UndecidedException, UntrustedException, NoAvailableSession
@ -84,7 +84,9 @@ class EchoBot(ClientXMPP):
return None return None
try: try:
body = self['xep_0384'].decrypt_message(msg, allow_untrusted) mfrom = msg['from']
encrypted = msg['omemo_encrypted']
body = self['xep_0384'].decrypt_message(encrypted, mfrom, allow_untrusted)
await self.encrypted_reply(msg, 'Thanks for sending\n%s' % body.decode("utf8")) await self.encrypted_reply(msg, 'Thanks for sending\n%s' % body.decode("utf8"))
except (MissingOwnKey,): except (MissingOwnKey,):
# The message is missing our own key, it was not encrypted for # The message is missing our own key, it was not encrypted for