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:
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user