plugin XEP-0384: give feedback to client when encryption failed

This commit is contained in:
Goffi 2019-03-20 09:08:47 +01:00
commit e89135b8ae

View file

@ -891,9 +891,11 @@ class OMEMO(object):
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)