From 3563232df061bd091356098f063175deed238ab9 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 7 Sep 2020 22:48:58 +0200 Subject: OMEMO: Don't trigger "Not encrypted to this device" warning for messages w/o payload --- plugins/omemo/src/logic/trust_manager.vala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins/omemo/src') diff --git a/plugins/omemo/src/logic/trust_manager.vala b/plugins/omemo/src/logic/trust_manager.vala index 66de44bc..a1d85199 100644 --- a/plugins/omemo/src/logic/trust_manager.vala +++ b/plugins/omemo/src/logic/trust_manager.vala @@ -304,9 +304,10 @@ public class TrustManager { } } + string? payload = encrypted.get_deep_string_content("payload"); + string? iv_node = header.get_deep_string_content("iv"); + foreach (StanzaNode key_node in our_nodes) { - string? payload = encrypted.get_deep_string_content("payload"); - string? iv_node = header.get_deep_string_content("iv"); string? key_node_content = key_node.get_string_content(); if (payload == null || iv_node == null || key_node_content == null) continue; uint8[] key; @@ -413,7 +414,11 @@ public class TrustManager { } } - if (our_nodes.size == 0 && module.store.local_registration_id != sid) { + if ( + payload != null && // Ratchet forwarding doesn't contain payload and might not include us, which is ok + our_nodes.size == 0 && // The message was not encrypted to us + module.store.local_registration_id != sid // Message from this device. Never encrypted to itself. + ) { db.identity_meta.update_last_message_undecryptable(identity_id, sid, message.time); trust_manager.bad_message_state_updated(conversation.account, message.from, sid); } -- cgit v1.2.3-54-g00ecf