From 9482ce616857cc5b954dbeb346febf9bb036e234 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Tue, 18 Jun 2019 06:23:06 +0200 Subject: Set foreground color for untrusted messages --- src/config/theme.c | 2 ++ src/config/theme.h | 2 +- src/ui/mucwin.c | 2 +- src/ui/ui.h | 2 +- src/ui/window.c | 11 +++++------ theme_template | 1 + themes/boothj5 | 1 + 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/config/theme.c b/src/config/theme.c index 4d868dd4..71f31842 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -153,6 +153,7 @@ theme_init(const char *const theme_name) g_hash_table_insert(defaults, strdup("roster.room.trigger"), strdup("green")); g_hash_table_insert(defaults, strdup("roster.room.mention"), strdup("green")); g_hash_table_insert(defaults, strdup("occupants.header"), strdup("yellow")); + g_hash_table_insert(defaults, strdup("untrusted"), strdup("red")); _load_preferences(); } @@ -854,6 +855,7 @@ theme_attrs(theme_item_t attrs) case THEME_ROSTER_ROOM_TRIGGER: _theme_prep_fgnd("roster.room.trigger", lookup_str, &bold); break; case THEME_ROSTER_ROOM_MENTION: _theme_prep_fgnd("roster.room.mention", lookup_str, &bold); break; case THEME_OCCUPANTS_HEADER: _theme_prep_fgnd("occupants.header", lookup_str, &bold); break; + case THEME_UNTRUSTED: _theme_prep_fgnd("untrusted", lookup_str, &bold); break; case THEME_WHITE: g_string_append(lookup_str, "white"); bold = FALSE; break; case THEME_WHITE_BOLD: g_string_append(lookup_str, "white"); bold = TRUE; break; case THEME_GREEN: g_string_append(lookup_str, "green"); bold = FALSE; break; diff --git a/src/config/theme.h b/src/config/theme.h index f4e575b9..5f68dd0f 100644 --- a/src/config/theme.h +++ b/src/config/theme.h @@ -117,6 +117,7 @@ typedef enum { THEME_ROSTER_ROOM_TRIGGER, THEME_ROSTER_ROOM_MENTION, THEME_RECEIPT_SENT, + THEME_UNTRUSTED, THEME_NONE, THEME_WHITE, THEME_WHITE_BOLD, @@ -134,7 +135,6 @@ typedef enum { THEME_BLACK_BOLD, THEME_MAGENTA, THEME_MAGENTA_BOLD, - THEME_NO_TRUST, } theme_item_t; void theme_init(const char *const theme_name); diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index e2c9abdc..119a0c7d 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -535,7 +535,7 @@ mucwin_incoming_msg(ProfMucWin *mucwin, prof_message_t *message, GSList *mention } if (!message->trusted) { - flags |= NO_TRUST; + flags |= UNTRUSTED; } ProfWin *window = (ProfWin*)mucwin; diff --git a/src/ui/ui.h b/src/ui/ui.h index edce5924..d64e4080 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -53,7 +53,7 @@ #define NO_EOL 4 #define NO_COLOUR_FROM 8 #define NO_COLOUR_DATE 16 -#define NO_TRUST 32 +#define UNTRUSTED 32 // core UI diff --git a/src/ui/window.c b/src/ui/window.c index d4bd3241..410e5e97 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1050,7 +1050,7 @@ win_print_incoming(ProfWin *window, const char *const from, prof_message_t *mess int flags = NO_ME; if (!message->trusted) { - flags |= NO_TRUST; + flags |= UNTRUSTED; } switch (window->type) @@ -1388,7 +1388,7 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim // 3rd bit = 0/1 - eol/no eol // 4th bit = 0/1 - color from/no color from // 5th bit = 0/1 - color date/no date - // 6th bit = 0/1 - not trusted/trusted + // 6th bit = 0/1 - trusted/untrusted gboolean me_message = FALSE; int offset = 0; int colour = theme_attrs(THEME_ME); @@ -1467,14 +1467,13 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim } } - if (flags & NO_TRUST) { - colour = theme_attrs(THEME_NO_TRUST); - } - if (!me_message) { if (receipt && !receipt->received) { wbkgdset(window->layout->win, theme_attrs(THEME_RECEIPT_SENT)); wattron(window->layout->win, theme_attrs(THEME_RECEIPT_SENT)); + } else if (flags & UNTRUSTED) { + wbkgdset(window->layout->win, theme_attrs(THEME_UNTRUSTED)); + wattron(window->layout->win, theme_attrs(THEME_UNTRUSTED)); } else { wbkgdset(window->layout->win, theme_attrs(theme_item)); wattron(window->layout->win, theme_attrs(theme_item)); diff --git a/theme_template b/theme_template index d59425de..b4f5b427 100644 --- a/theme_template +++ b/theme_template @@ -76,6 +76,7 @@ roster.room.trigger= roster.room.mention= occupants.header= receipt.sent= +untrusted= [ui] beep= diff --git a/themes/boothj5 b/themes/boothj5 index ae8ff914..fee2a7d7 100644 --- a/themes/boothj5 +++ b/themes/boothj5 @@ -77,6 +77,7 @@ roster.room.mention=bold_cyan roster.room.trigger=bold_blue occupants.header=bold_yellow receipt.sent=bold_black +receipt.sent=bold_red [ui] beep=false -- cgit 1.4.1-2-gfad0