Commit 609bfc69 authored by ValdikSS's avatar ValdikSS

Display OMEMO decryption error to the user instead of silently dropping the message

If in Multiuser Conference with OMEMO encryption enabled users
of this group send OMEMO-encrypted messages without encrypting it with
your key, you won't get any visible in-chat notification for this message
and won't know if they send anything at all.

This patch fixes this issue.
parent 13d61751
...@@ -310,14 +310,21 @@ class OMEMOConnection: ...@@ -310,14 +310,21 @@ class OMEMOConnection:
get_jid_without_resource(from_jid) get_jid_without_resource(from_jid)
plaintext = self.omemo.decrypt_msg(msg_dict) plaintext = self.omemo.decrypt_msg(msg_dict)
show_error = False
if not plaintext: if not plaintext:
msg.encrypted = 'drop' if self.omemo.own_device_id not in msg_dict['keys']:
return show_error = True
plaintext = 'Received OMEMO-encrypted message does not contain our device key, can\'t decrypt'
msg.encrypted = 'drop'
else:
return
msg.msgtxt = plaintext msg.msgtxt = plaintext
# Gajim bug: there must be a body or the message # Gajim bug: there must be a body or the message
# gets dropped from history # gets dropped from history
msg.stanza.setBody(plaintext) if not show_error:
msg.stanza.setBody(plaintext)
msg.encrypted = self.plugin.encryption_name msg.encrypted = self.plugin.encryption_name
self.add_additional_data(msg.additional_data) self.add_additional_data(msg.additional_data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment