# HG changeset patch # User Goffi # Date 1546694111 -3600 # Node ID 1f612547fb2ef1b044925fc8aa3b9f0d0cb61815 # Parent 1048d8dc8a9d60571eee37a5e54ed6b03a44d0e3 plugin XEP-0384: give feedback to user when trust must be handled before sending a message diff -r 1048d8dc8a9d -r 1f612547fb2e sat/plugins/plugin_xep_0384.py --- 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(