diff sat/plugins/plugin_xep_0384.py @ 2859:4e875d9eea48

plugin XEP-0384: give feedback to client when encryption failed
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:08:47 +0100
parents 31a5038cdf79
children 851c47cc4ae7
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0384.py	Wed Mar 20 09:08:47 2019 +0100
+++ b/sat/plugins/plugin_xep_0384.py	Wed Mar 20 09:08:47 2019 +0100
@@ -891,9 +891,11 @@
                 else:
                     break
         except Exception as e:
-            log.warning(
-                _(u"Can't encrypt message for {entity}: {reason}".format(
-                entity=entity_bare_jid.full(), reason=str(e).decode('utf-8', 'replace'))))
+            msg = _(u"Can't encrypt message for {entity}: {reason}".format(
+                entity=entity_bare_jid.full(), reason=str(e).decode('utf-8', 'replace')))
+            log.warning(msg)
+            extra = {C.MESS_EXTRA_INFO: C.EXTRA_INFO_ENCR_ERR}
+            client.feedback(entity_bare_jid, msg, extra)
             raise e
 
         defer.returnValue(encrypted)