From 7e5a2f59cf4886dbf1a28a32933bfd1e2567387b Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 4 Jan 2019 18:47:56 +0100 Subject: [PATCH] plugin XEP-0380, XEP-0384: use C.EXTRA_INFO_DECR_ERR as info sub-type when a message can't be decrypted. --- sat/plugins/plugin_xep_0380.py | 2 +- sat/plugins/plugin_xep_0384.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sat/plugins/plugin_xep_0380.py b/sat/plugins/plugin_xep_0380.py index b83a6195..df0c252b 100644 --- a/sat/plugins/plugin_xep_0380.py +++ b/sat/plugins/plugin_xep_0380.py @@ -96,6 +96,6 @@ class XEP_0380(object): u"User {sender} sent you an encrypted message (encrypted with {algorithm}), " u"and we can't decrypt it.").format(sender=sender_s, algorithm=algorithm) - extra = {C.MESS_EXTRA_INFO: u"UNKNOWN_ENCRYPTION"} + extra = {C.MESS_EXTRA_INFO: C.EXTRA_INFO_DECR_ERR} client.feedback(to_jid, user_msg, extra) return False diff --git a/sat/plugins/plugin_xep_0384.py b/sat/plugins/plugin_xep_0384.py index fd73b762..1a6129c9 100644 --- a/sat/plugins/plugin_xep_0384.py +++ b/sat/plugins/plugin_xep_0384.py @@ -991,6 +991,10 @@ class OMEMO(object): except Exception as e: log.warning(_(u"Can't decrypt message: {reason}\n{xml}").format( reason=e, xml=message_elt.toXml())) + user_msg = (D_(u"An OMEMO message from {sender} can't be decrypted: {reason}") + .format(sender=from_jid.full(), reason=e)) + extra = {C.MESS_EXTRA_INFO: C.EXTRA_INFO_DECR_ERR} + client.feedback(from_jid, user_msg, extra) defer.returnValue(False) if omemo_session.republish_bundle: # we don't wait for the Deferred (i.e. no yield) on purpose