feat(omemo): suppress repetitive missing device ID warnings

When sending OMEMO messages, we print a warning message for every
participant without a device ID on every single send:

```
Can't find a OMEMO device id for my@jid.org
```

This clutters the UI due to the high volume of repetitive information.

This is solved by tracking suppressed warnings within the window
structure. A warning for a specific JID and type is only shown once
per window context.

Suppression state is stored in the base ProfWin structure and managed
via helper functions (win_warn_needed, win_warn_sent). The state is
lazily initialized to save resources and automatically cleaned up when
the window is closed.

Warnings are explicitly reset when an OMEMO session is started or
ended to ensure users see fresh alerts when toggling encryption.
This commit is contained in:
Michael Vetter
2026-03-18 20:05:04 +01:00
parent 9de455ceea
commit 321ff57150
6 changed files with 74 additions and 1 deletions

View File

@@ -30,6 +30,7 @@
#include "omemo/omemo.h"
#include "omemo/store.h"
#include "ui/ui.h"
#include "ui/window.h"
#include "ui/window_list.h"
#include "xmpp/connection.h"
#include "xmpp/muc.h"
@@ -822,7 +823,11 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_
recipient_device_id = g_hash_table_lookup(omemo_ctx.device_list, recipients_iter->data);
if (!recipient_device_id) {
log_warning("[OMEMO][SEND] cannot find device ids for %s", recipients_iter->data);
win_println(win, THEME_ERROR, "!", "Can't find a OMEMO device id for %s.\n", recipients_iter->data);
if (win_warn_needed(win, "omemo_no_device", recipients_iter->data)) {
win_println(win, THEME_ERROR, "!", "Can't find a OMEMO device id for %s.", recipients_iter->data);
win_warn_sent(win, "omemo_no_device", recipients_iter->data);
}
continue;
}