mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 09:06:21 +00:00
Add titlebar encryption text to plugins api
This commit is contained in:
@@ -385,6 +385,24 @@ chatwin_get_string(ProfChatWin *chatwin)
|
||||
return resstr;
|
||||
}
|
||||
|
||||
void
|
||||
chatwin_set_enctext(ProfChatWin *chatwin, const char *const enctext)
|
||||
{
|
||||
if (chatwin->enctext) {
|
||||
free(chatwin->enctext);
|
||||
}
|
||||
chatwin->enctext = strdup(enctext);
|
||||
}
|
||||
|
||||
void
|
||||
chatwin_unset_enctext(ProfChatWin *chatwin)
|
||||
{
|
||||
if (chatwin->enctext) {
|
||||
free(chatwin->enctext);
|
||||
chatwin->enctext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_chatwin_history(ProfChatWin *chatwin, const char *const contact)
|
||||
{
|
||||
|
||||
@@ -319,6 +319,20 @@ _show_privacy(ProfChatWin *chatwin)
|
||||
int trusted_attrs = theme_attrs(THEME_TITLE_TRUSTED);
|
||||
int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED);
|
||||
|
||||
if (chatwin->enctext) {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, encrypted_attrs);
|
||||
wprintw(win, chatwin->enctext);
|
||||
wattroff(win, encrypted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (chatwin->is_otr) {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
@@ -353,7 +367,11 @@ _show_privacy(ProfChatWin *chatwin)
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
} else if (chatwin->pgp_send || chatwin->pgp_recv) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (chatwin->pgp_send || chatwin->pgp_recv) {
|
||||
GString *pgpmsg = g_string_new("PGP ");
|
||||
if (chatwin->pgp_send && !chatwin->pgp_recv) {
|
||||
g_string_append(pgpmsg, "send");
|
||||
@@ -373,19 +391,21 @@ _show_privacy(ProfChatWin *chatwin)
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
g_string_free(pgpmsg, TRUE);
|
||||
} else {
|
||||
if (prefs_get_boolean(PREF_ENC_WARN)) {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, unencrypted_attrs);
|
||||
wprintw(win, "unencrypted");
|
||||
wattroff(win, unencrypted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_ENC_WARN)) {
|
||||
wprintw(win, " ");
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, unencrypted_attrs);
|
||||
wprintw(win, "unencrypted");
|
||||
wattroff(win, unencrypted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +140,8 @@ void chatwin_otr_trust(ProfChatWin *chatwin);
|
||||
void chatwin_otr_untrust(ProfChatWin *chatwin);
|
||||
void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *data);
|
||||
#endif
|
||||
void chatwin_set_enctext(ProfChatWin *chatwin, const char *const enctext);
|
||||
void chatwin_unset_enctext(ProfChatWin *chatwin);
|
||||
|
||||
// MUC window
|
||||
void mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const actor, const char *const reason);
|
||||
|
||||
@@ -155,6 +155,7 @@ typedef struct prof_chat_win_t {
|
||||
char *resource_override;
|
||||
gboolean history_shown;
|
||||
unsigned long memcheck;
|
||||
char *enctext;
|
||||
} ProfChatWin;
|
||||
|
||||
typedef struct prof_muc_win_t {
|
||||
|
||||
@@ -146,6 +146,7 @@ win_create_chat(const char *const barejid)
|
||||
new_win->history_shown = FALSE;
|
||||
new_win->unread = 0;
|
||||
new_win->state = chat_state_new();
|
||||
new_win->enctext = NULL;
|
||||
|
||||
new_win->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
|
||||
@@ -430,6 +431,7 @@ win_free(ProfWin* window)
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
free(chatwin->barejid);
|
||||
free(chatwin->resource_override);
|
||||
free(chatwin->enctext);
|
||||
chat_state_free(chatwin->state);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user