feat(omemo): suppress "new device" alerts for already known devices

Modify omemo_set_device_list to check against the persistent
known_devices.txt file before notifying the user. This prevents
false-positive security alerts on every restart for devices
that have already been registered and trusted.

Check against the persistent known_devices.txt file before notifying
the user. This ensures that "New OMEMO device" alerts are only shown
for devices that are truly new to this client.

Ref: ce9b5140d
This commit is contained in:
Michael Vetter
2026-03-18 22:14:45 +01:00
parent 4253da99c5
commit b7c8f8235c

View File

@@ -515,6 +515,8 @@ omemo_set_device_list(const char* const from, GList* device_list)
} }
if (!found) { if (!found) {
auto_gchar gchar* dev_id_str = g_strdup_printf("%u", dev_id);
if (!g_key_file_has_key(omemo_ctx.knowndevices.keyfile, jid->barejid, dev_id_str, NULL)) {
if (equals_our_barejid(jid->barejid)) { if (equals_our_barejid(jid->barejid)) {
if (dev_id != omemo_ctx.device_id) { if (dev_id != omemo_ctx.device_id) {
cons_show("New OMEMO device (ID: %u) added to your account.", dev_id); cons_show("New OMEMO device (ID: %u) added to your account.", dev_id);
@@ -533,6 +535,7 @@ omemo_set_device_list(const char* const from, GList* device_list)
} }
} }
} }
}
g_hash_table_insert(omemo_ctx.device_list, strdup(jid->barejid), device_list); g_hash_table_insert(omemo_ctx.device_list, strdup(jid->barejid), device_list);