diff options
author | Paul Fariello <paul@fariello.eu> | 2019-06-16 22:55:07 +0200 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-06-20 14:30:37 +0200 |
commit | 3bb3cc625d1714fd5e81ef0adba61a5172c3212d (patch) | |
tree | 1dea4bfe4da4f67d2ba03a70b9bab3ce455763d6 /src/ui | |
parent | a650ecc67d700ae14a1bd05ca6196533829ba5ce (diff) | |
download | profani-tty-3bb3cc625d1714fd5e81ef0adba61a5172c3212d.tar.gz |
Use flags in xmmp/message.c for encryption and trust
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui.h | 7 | ||||
-rw-r--r-- | src/ui/window.c | 14 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h index b80e5630..51d80b34 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -53,13 +53,6 @@ #define NO_COLOUR_FROM 8 #define NO_COLOUR_DATE 16 -typedef enum { - PROF_MSG_PLAIN, - PROF_MSG_OTR, - PROF_MSG_PGP, - PROF_MSG_OMEMO -} prof_enc_t; - // core UI void ui_init(void); void ui_load_colours(void); diff --git a/src/ui/window.c b/src/ui/window.c index 12b6c15b..90508917 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1048,6 +1048,11 @@ win_print_incoming(ProfWin *window, GDateTime *timestamp, const char *const from, const char *const message, prof_enc_t enc_mode) { char enc_char = '-'; + int flags = NO_ME; + + if (!trusted) { + flags != NO_TRUST; + } switch (window->type) { @@ -1063,11 +1068,11 @@ win_print_incoming(ProfWin *window, GDateTime *timestamp, } else if (enc_mode == PROF_MSG_OMEMO) { enc_char = prefs_get_omemo_char(); } - _win_printf(window, enc_char, 0, timestamp, NO_ME, THEME_TEXT_THEM, from, "%s", message); + _win_printf(window, enc_char, 0, timestamp, flags, THEME_TEXT_THEM, from, "%s", message); break; } case WIN_PRIVATE: - _win_printf(window, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, from, "%s", message); + _win_printf(window, '-', 0, timestamp, flags, THEME_TEXT_THEM, from, "%s", message); break; default: assert(FALSE); @@ -1384,6 +1389,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 gboolean me_message = FALSE; int offset = 0; int colour = theme_attrs(THEME_ME); @@ -1462,6 +1468,10 @@ _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)); |