Use flags in xmmp/message.c for encryption and trust

This commit is contained in:
Paul Fariello
2019-06-16 22:55:07 +02:00
parent a650ecc67d
commit 3bb3cc625d
6 changed files with 44 additions and 25 deletions

View File

@@ -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);

View File

@@ -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));