mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 00:56:21 +00:00
fix: reduce OMEMO trust check frequency + trust indicators in titlebar (upstream 62458557)
This commit is contained in:
@@ -451,6 +451,32 @@ _show_muc_privacy(ProfMucWin* mucwin)
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (mucwin->omemo_trusted) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -580,6 +606,32 @@ _show_privacy(ProfChatWin* chatwin)
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (chatwin->omemo_trusted) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ typedef struct prof_chat_win_t
|
||||
gboolean pgp_send;
|
||||
gboolean pgp_recv;
|
||||
gboolean is_omemo;
|
||||
gboolean omemo_trusted;
|
||||
gboolean is_ox; // XEP-0373: OpenPGP for XMPP
|
||||
char* resource_override;
|
||||
gboolean history_shown;
|
||||
@@ -203,6 +204,7 @@ typedef struct prof_muc_win_t
|
||||
gboolean showjid;
|
||||
gboolean showoffline;
|
||||
gboolean is_omemo;
|
||||
gboolean omemo_trusted;
|
||||
unsigned long memcheck;
|
||||
char* enctext;
|
||||
char* message_char;
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
#include "config.h"
|
||||
#include "database.h"
|
||||
#include "ui/window_list.h"
|
||||
#ifdef HAVE_OMEMO
|
||||
#include "omemo/omemo.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -170,6 +173,9 @@ win_create_chat(const char* const barejid)
|
||||
new_win->pgp_recv = FALSE;
|
||||
new_win->pgp_send = FALSE;
|
||||
new_win->is_omemo = FALSE;
|
||||
#ifdef HAVE_OMEMO
|
||||
new_win->omemo_trusted = omemo_is_jid_trusted(barejid);
|
||||
#endif
|
||||
new_win->is_ox = FALSE;
|
||||
new_win->history_shown = FALSE;
|
||||
new_win->unread = 0;
|
||||
@@ -236,6 +242,9 @@ win_create_muc(const char* const roomjid)
|
||||
new_win->enctext = NULL;
|
||||
new_win->message_char = NULL;
|
||||
new_win->is_omemo = FALSE;
|
||||
#ifdef HAVE_OMEMO
|
||||
new_win->omemo_trusted = omemo_is_jid_trusted(roomjid);
|
||||
#endif
|
||||
new_win->last_message = NULL;
|
||||
new_win->last_msg_id = NULL;
|
||||
new_win->has_attention = FALSE;
|
||||
|
||||
@@ -1017,6 +1017,31 @@ _wins_get_next_available_num(GList* used)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wins_omemo_trust_changed(const char* const jid)
|
||||
{
|
||||
GList* curr = values;
|
||||
while (curr) {
|
||||
ProfWin* window = curr->data;
|
||||
if (window->type == WIN_CHAT) {
|
||||
ProfChatWin* chatwin = (ProfChatWin*)window;
|
||||
if (jid == NULL || strcmp(chatwin->barejid, jid) == 0) {
|
||||
#ifdef HAVE_OMEMO
|
||||
chatwin->omemo_trusted = omemo_is_jid_trusted(chatwin->barejid);
|
||||
#endif
|
||||
}
|
||||
} else if (window->type == WIN_MUC) {
|
||||
ProfMucWin* mucwin = (ProfMucWin*)window;
|
||||
if (jid == NULL || strcmp(mucwin->roomjid, jid) == 0) {
|
||||
#ifdef HAVE_OMEMO
|
||||
mucwin->omemo_trusted = omemo_is_jid_trusted(mucwin->roomjid);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
wins_tidy(void)
|
||||
{
|
||||
|
||||
@@ -88,6 +88,7 @@ GSList* wins_get_chat_recipients(void);
|
||||
GSList* wins_get_prune_wins(void);
|
||||
void wins_lost_connection(void);
|
||||
void wins_reestablished_connection(void);
|
||||
void wins_omemo_trust_changed(const char* const jid);
|
||||
gboolean wins_tidy(void);
|
||||
GSList* wins_create_summary(gboolean unread);
|
||||
GSList* wins_create_summary_attention();
|
||||
|
||||
Reference in New Issue
Block a user