aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-09-07 22:48:58 +0200
committerfiaxh <git@lightrise.org>2020-09-10 19:35:05 +0200
commit3563232df061bd091356098f063175deed238ab9 (patch)
treec44b93be96b7856fe2fdbca2b00b236130bb3b48
parentc01d09d5198037582145fc68bba62a0fb947b7ec (diff)
downloaddino-3563232df061bd091356098f063175deed238ab9.tar.gz
dino-3563232df061bd091356098f063175deed238ab9.zip
OMEMO: Don't trigger "Not encrypted to this device" warning for messages w/o payload
-rw-r--r--plugins/omemo/src/logic/trust_manager.vala11
1 files changed, 8 insertions, 3 deletions
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);
}