Mercurial > libervia-backend
changeset 2757:1f612547fb2e
plugin XEP-0384: give feedback to user when trust must be handled before sending a message
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 05 Jan 2019 14:15:11 +0100 |
parents | 1048d8dc8a9d |
children | f4070693814a |
files | sat/plugins/plugin_xep_0384.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0384.py Fri Jan 04 19:12:43 2019 +0100 +++ b/sat/plugins/plugin_xep_0384.py Sat Jan 05 14:15:11 2019 +0100 @@ -823,9 +823,10 @@ ## triggers @defer.inlineCallbacks - def handleProblems(self, client, bundles, problems): + def handleProblems(self, client, entity, bundles, problems): """Try to solve problem found by EncryptMessage + @param entity(jid.JID): bare jid of the destinee @param bundles(dict): bundles data as used in EncryptMessage already filled with known bundles, missing bundles need to be added to it @@ -851,6 +852,11 @@ 'device': data.device, 'ik': data.ik} + user_msg = D_(u"Not all destination devices are trusted, we can't encrypt " + u"message in such a situation. Please indicate if you trust " + u"those devices or not in the trust manager before we can " + "send this message") + client.feedback(entity, user_msg) xmlui = yield self.getTrustUI(client, trust_data=trust_data, submit_id=u"") answer = yield xml_tools.deferXMLUI( @@ -898,7 +904,7 @@ bundles) except omemo_excpt.EncryptionProblemsException as e: # we know the problem to solve, we can try to fix them - expect_problems = yield self.handleProblems(client, bundles, e.problems) + expect_problems = yield self.handleProblems(client, entity_bare_jid, bundles, e.problems) # and try an encryption again. try: encrypted = yield omemo_session.encryptMessage(