[omemo] Show error when message was not encrypted for our device

Fixes #452
This commit is contained in:
Philipp Hörist
2019-11-09 21:32:28 +01:00
parent f36c9e99cf
commit bed46293e6

View File

@@ -242,9 +242,17 @@ class OMEMO(BaseModule):
trust = Trust.VERIFIED
del self._muc_temp_store[properties.omemo.payload]
except (DecryptionFailed, MessageNotForDevice):
except DecryptionFailed:
return
except MessageNotForDevice:
plaintext = _('This message was encrypted with OMEMO, '
'but not for your device.')
# Neither trust nor fingerprint can be verified if we didn't
# successfully decrypt the message
trust = Trust.UNTRUSTED
fingerprint = None
prepare_stanza(stanza, plaintext)
self._debug_print_stanza(stanza)
properties.encrypted = EncryptionData({'name': ENCRYPTION_NAME,