Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0384.py @ 2857:88f10630d5ea
plugin XEP-0384: removed version restriction, it is now compatible with (and require) last version of python-omemo (0.10.4)
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 20 Mar 2019 09:08:37 +0100 |
parents | 11afbbce40d1 |
children | 31a5038cdf79 |
comparison
equal
deleted
inserted
replaced
2856:26d6ac4e4a66 | 2857:88f10630d5ea |
---|---|
54 C.PI_MAIN: u"OMEMO", | 54 C.PI_MAIN: u"OMEMO", |
55 C.PI_HANDLER: u"no", | 55 C.PI_HANDLER: u"no", |
56 C.PI_DESCRIPTION: _(u"""Implementation of OMEMO"""), | 56 C.PI_DESCRIPTION: _(u"""Implementation of OMEMO"""), |
57 } | 57 } |
58 | 58 |
59 OMEMO_MIN_VER = (0, 10, 3) | 59 OMEMO_MIN_VER = (0, 10, 4) |
60 NS_OMEMO = "eu.siacs.conversations.axolotl" | 60 NS_OMEMO = "eu.siacs.conversations.axolotl" |
61 NS_OMEMO_DEVICES = NS_OMEMO + ".devicelist" | 61 NS_OMEMO_DEVICES = NS_OMEMO + ".devicelist" |
62 NS_OMEMO_BUNDLE = NS_OMEMO + ".bundles:{device_id}" | 62 NS_OMEMO_BUNDLE = NS_OMEMO + ".bundles:{device_id}" |
63 KEY_STATE = "STATE" | 63 KEY_STATE = "STATE" |
64 KEY_DEVICE_ID = "DEVICE_ID" | 64 KEY_DEVICE_ID = "DEVICE_ID" |
799 untrusted = {} | 799 untrusted = {} |
800 missing_bundles = {} | 800 missing_bundles = {} |
801 expect_problems = {} | 801 expect_problems = {} |
802 cache = client._xep_0384_cache | 802 cache = client._xep_0384_cache |
803 for problem in problems: | 803 for problem in problems: |
804 if isinstance(problem, omemo_excpt.UntrustedException): | 804 if isinstance(problem, omemo_excpt.TrustException): |
805 untrusted[unicode(hash(problem))] = problem | 805 untrusted[unicode(hash(problem))] = problem |
806 if isinstance(problem, omemo_excpt.MissingBundleException): | 806 if isinstance(problem, omemo_excpt.MissingBundleException): |
807 pb_entity = jid.JID(problem.bare_jid) | 807 pb_entity = jid.JID(problem.bare_jid) |
808 entity_cache = cache.setdefault(pb_entity, {}) | 808 entity_cache = cache.setdefault(pb_entity, {}) |
809 entity_bundles = bundles.setdefault(pb_entity, {}) | 809 entity_bundles = bundles.setdefault(pb_entity, {}) |
964 "additional_information": additional_information, | 964 "additional_information": additional_information, |
965 } | 965 } |
966 try: | 966 try: |
967 try: | 967 try: |
968 plaintext = yield omemo_session.decryptMessage(**kwargs) | 968 plaintext = yield omemo_session.decryptMessage(**kwargs) |
969 except omemo_excpt.UntrustedException: | 969 except omemo_excpt.TrustException: |
970 post_treat.addCallback(client.encryption.markAsUntrusted) | 970 post_treat.addCallback(client.encryption.markAsUntrusted) |
971 kwargs['allow_untrusted'] = True | 971 kwargs['allow_untrusted'] = True |
972 plaintext = yield omemo_session.decryptMessage(**kwargs) | 972 plaintext = yield omemo_session.decryptMessage(**kwargs) |
973 else: | 973 else: |
974 post_treat.addCallback(client.encryption.markAsTrusted) | 974 post_treat.addCallback(client.encryption.markAsTrusted) |