Adapt example to new decrypt API
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
62b6037611
commit
79a4f417ed
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue