mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 14:56:22 +00:00
feat: Add OMEMO trust status indicators to the titlebar
Previously the titlebar only showed [OMEMO], regardless of whether the active session contained untrusted devices. This forced users to manually run /omemo fingerprint to check the security status of their conversation, making it difficult to know at a glance if a session was truly secure. New function `omemo_is_jid_trusted()` to check if all active devices for a JID are trusted. Update chat and MUC titlebar to display [trusted] or [untrusted] tags when an OMEMO session is active. Not sure if MUC makes sense here?
This commit is contained in:
@@ -49,6 +49,9 @@
|
||||
#include "ui/window_list.h"
|
||||
#include "ui/window.h"
|
||||
#include "ui/screen.h"
|
||||
#ifdef HAVE_OMEMO
|
||||
#include "omemo/omemo.h"
|
||||
#endif
|
||||
#include "xmpp/roster_list.h"
|
||||
#include "xmpp/chat_session.h"
|
||||
|
||||
@@ -412,6 +415,8 @@ _show_muc_privacy(ProfMucWin* mucwin)
|
||||
int encrypted_attrs = theme_attrs(THEME_TITLE_ENCRYPTED);
|
||||
|
||||
if (mucwin->is_omemo) {
|
||||
int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED);
|
||||
int trusted_attrs = theme_attrs(THEME_TITLE_TRUSTED);
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
@@ -423,6 +428,32 @@ _show_muc_privacy(ProfMucWin* mucwin)
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo_is_jid_trusted(mucwin->roomjid)) {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, trusted_attrs);
|
||||
wprintw(win, "trusted");
|
||||
wattroff(win, trusted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
} else {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, untrusted_attrs);
|
||||
wprintw(win, "untrusted");
|
||||
wattroff(win, untrusted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -552,6 +583,32 @@ _show_privacy(ProfChatWin* chatwin)
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo_is_jid_trusted(chatwin->barejid)) {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, trusted_attrs);
|
||||
wprintw(win, "trusted");
|
||||
wattroff(win, trusted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
} else {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, untrusted_attrs);
|
||||
wprintw(win, "untrusted");
|
||||
wattroff(win, untrusted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user