diff options
Diffstat (limited to 'src/ui/titlebar.c')
-rw-r--r-- | src/ui/titlebar.c | 98 |
1 files changed, 54 insertions, 44 deletions
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 746d2782..16a9eaff 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -58,9 +58,7 @@ static GTimer *typing_elapsed; static void _title_bar_draw(void); static void _show_self_presence(void); static void _show_contact_presence(ProfChatWin *chatwin); -#ifdef HAVE_LIBOTR static void _show_privacy(ProfChatWin *chatwin); -#endif void create_title_bar(void) @@ -174,10 +172,7 @@ _title_bar_draw(void) ProfChatWin *chatwin = (ProfChatWin*) current; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); _show_contact_presence(chatwin); - -#ifdef HAVE_LIBOTR _show_privacy(chatwin); -#endif if (typing) { wprintw(win, " (typing...)"); @@ -246,66 +241,81 @@ _show_self_presence(void) wattroff(win, bracket_attrs); } -#ifdef HAVE_LIBOTR static void _show_privacy(ProfChatWin *chatwin) { int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET); + int encrypted_attrs = theme_attrs(THEME_TITLE_ENCRYPTED); + int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED); + int trusted_attrs = theme_attrs(THEME_TITLE_TRUSTED); + int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED); + + switch (chatwin->enc_mode) { + case PROF_ENC_NONE: + 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); + } + break; - if (chatwin->enc_mode == PROF_ENC_NONE) { - if (prefs_get_boolean(PREF_OTR_WARN)) { - int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED); + case PROF_ENC_OTR: 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, encrypted_attrs); + wprintw(win, "OTR"); + wattroff(win, encrypted_attrs); wattron(win, bracket_attrs); wprintw(win, "]"); wattroff(win, bracket_attrs); - } - } else { - int encrypted_attrs = theme_attrs(THEME_TITLE_ENCRYPTED); - wprintw(win, " "); - wattron(win, bracket_attrs); - wprintw(win, "["); - wattroff(win, bracket_attrs); - wattron(win, encrypted_attrs); - wprintw(win, "OTR"); - wattroff(win, encrypted_attrs); - wattron(win, bracket_attrs); - wprintw(win, "]"); - wattroff(win, bracket_attrs); - if (chatwin->otr_is_trusted) { - int trusted_attrs = theme_attrs(THEME_TITLE_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 { - int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED); + if (chatwin->otr_is_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); + } + break; + + case PROF_ENC_PGP: 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, encrypted_attrs); + wprintw(win, "PGP"); + wattroff(win, encrypted_attrs); wattron(win, bracket_attrs); wprintw(win, "]"); wattroff(win, bracket_attrs); - } + break; } } -#endif static void _show_contact_presence(ProfChatWin *chatwin) |