From b1de8a400525e685b1e1d24fcb790d523bcacecd Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 17 Jan 2014 00:06:08 +0000 Subject: Added OTR remaining system messages and colouring --- src/config/theme.c | 80 ++++++++++++++++++++++++++++++++++++++---------------- src/config/theme.h | 63 ++++++++++++++++++++++-------------------- 2 files changed, 90 insertions(+), 53 deletions(-) (limited to 'src/config') diff --git a/src/config/theme.c b/src/config/theme.c index 1d7d04cf..24ea9a91 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -91,6 +91,11 @@ static struct colours_t { NCURSES_COLOR_T roominfo; NCURSES_COLOR_T me; NCURSES_COLOR_T them; + NCURSES_COLOR_T otrstartedtrusted; + NCURSES_COLOR_T otrstarteduntrusted; + NCURSES_COLOR_T otrended; + NCURSES_COLOR_T otrtrusted; + NCURSES_COLOR_T otruntrusted; } colour_prefs; static NCURSES_COLOR_T _lookup_colour(const char * const colour); @@ -199,41 +204,48 @@ theme_init_colours(void) init_pair(6, colour_prefs.timetext, colour_prefs.bkgnd); // title bar - init_pair(10, colour_prefs.titlebartext, colour_prefs.titlebar); - init_pair(11, colour_prefs.titlebarbrackets, colour_prefs.titlebar); - init_pair(12, colour_prefs.titlebarunencrypted, colour_prefs.titlebar); - init_pair(13, colour_prefs.titlebarencrypted, colour_prefs.titlebar); - init_pair(14, colour_prefs.titlebaruntrusted, colour_prefs.titlebar); - init_pair(15, colour_prefs.titlebartrusted, colour_prefs.titlebar); + init_pair(7, colour_prefs.titlebartext, colour_prefs.titlebar); + init_pair(8, colour_prefs.titlebarbrackets, colour_prefs.titlebar); + init_pair(9, colour_prefs.titlebarunencrypted, colour_prefs.titlebar); + init_pair(10, colour_prefs.titlebarencrypted, colour_prefs.titlebar); + init_pair(11, colour_prefs.titlebaruntrusted, colour_prefs.titlebar); + init_pair(12, colour_prefs.titlebartrusted, colour_prefs.titlebar); // status bar - init_pair(20, colour_prefs.statusbartext, colour_prefs.statusbar); - init_pair(21, colour_prefs.statusbarbrackets, colour_prefs.statusbar); - init_pair(22, colour_prefs.statusbaractive, colour_prefs.statusbar); - init_pair(23, colour_prefs.statusbarnew, colour_prefs.statusbar); + init_pair(13, colour_prefs.statusbartext, colour_prefs.statusbar); + init_pair(14, colour_prefs.statusbarbrackets, colour_prefs.statusbar); + init_pair(15, colour_prefs.statusbaractive, colour_prefs.statusbar); + init_pair(16, colour_prefs.statusbarnew, colour_prefs.statusbar); // chat - init_pair(30, colour_prefs.me, colour_prefs.bkgnd); - init_pair(31, colour_prefs.them, colour_prefs.bkgnd); + init_pair(17, colour_prefs.me, colour_prefs.bkgnd); + init_pair(18, colour_prefs.them, colour_prefs.bkgnd); // room chat - init_pair(40, colour_prefs.roominfo, colour_prefs.bkgnd); + init_pair(19, colour_prefs.roominfo, colour_prefs.bkgnd); // statuses - init_pair(50, colour_prefs.online, colour_prefs.bkgnd); - init_pair(51, colour_prefs.offline, colour_prefs.bkgnd); - init_pair(52, colour_prefs.away, colour_prefs.bkgnd); - init_pair(53, colour_prefs.chat, colour_prefs.bkgnd); - init_pair(54, colour_prefs.dnd, colour_prefs.bkgnd); - init_pair(55, colour_prefs.xa, colour_prefs.bkgnd); + init_pair(20, colour_prefs.online, colour_prefs.bkgnd); + init_pair(21, colour_prefs.offline, colour_prefs.bkgnd); + init_pair(22, colour_prefs.away, colour_prefs.bkgnd); + init_pair(23, colour_prefs.chat, colour_prefs.bkgnd); + init_pair(24, colour_prefs.dnd, colour_prefs.bkgnd); + init_pair(25, colour_prefs.xa, colour_prefs.bkgnd); // states - init_pair(60, colour_prefs.typing, colour_prefs.bkgnd); - init_pair(61, colour_prefs.gone, colour_prefs.bkgnd); + init_pair(26, colour_prefs.typing, colour_prefs.bkgnd); + init_pair(27, colour_prefs.gone, colour_prefs.bkgnd); // subscription status - init_pair(70, colour_prefs.subscribed, colour_prefs.bkgnd); - init_pair(71, colour_prefs.unsubscribed, colour_prefs.bkgnd); + init_pair(28, colour_prefs.subscribed, colour_prefs.bkgnd); + init_pair(29, colour_prefs.unsubscribed, colour_prefs.bkgnd); + + // otr messages + init_pair(30, colour_prefs.otrstartedtrusted, colour_prefs.bkgnd); + init_pair(31, colour_prefs.otrstarteduntrusted, colour_prefs.bkgnd); + init_pair(32, colour_prefs.otrended, colour_prefs.bkgnd); + init_pair(33, colour_prefs.otrtrusted, colour_prefs.bkgnd); + init_pair(34, colour_prefs.otruntrusted, colour_prefs.bkgnd); } static NCURSES_COLOR_T @@ -297,7 +309,7 @@ _load_colours(void) g_free(titlebarencrypted_val); gchar *titlebaruntrusted_val = g_key_file_get_string(theme, "colours", "titlebar.untrusted", NULL); - _set_colour(titlebaruntrusted_val, &colour_prefs.titlebaruntrusted, COLOR_RED); + _set_colour(titlebaruntrusted_val, &colour_prefs.titlebaruntrusted, COLOR_YELLOW); g_free(titlebaruntrusted_val); gchar *titlebartrusted_val = g_key_file_get_string(theme, "colours", "titlebar.trusted", NULL); @@ -344,6 +356,26 @@ _load_colours(void) _set_colour(unsubscribed_val, &colour_prefs.unsubscribed, COLOR_RED); g_free(unsubscribed_val); + gchar *otrstartedtrusted_val = g_key_file_get_string(theme, "colours", "otr.started.trusted", NULL); + _set_colour(otrstartedtrusted_val, &colour_prefs.otrstartedtrusted, COLOR_GREEN); + g_free(otrstartedtrusted_val); + + gchar *otrstarteduntrusted_val = g_key_file_get_string(theme, "colours", "otr.started.untrusted", NULL); + _set_colour(otrstarteduntrusted_val, &colour_prefs.otrstarteduntrusted, COLOR_YELLOW); + g_free(otrstarteduntrusted_val); + + gchar *otrended_val = g_key_file_get_string(theme, "colours", "otr.ended", NULL); + _set_colour(otrended_val, &colour_prefs.otrended, COLOR_RED); + g_free(otrended_val); + + gchar *otrtrusted_val = g_key_file_get_string(theme, "colours", "otr.trusted", NULL); + _set_colour(otrtrusted_val, &colour_prefs.otrtrusted, COLOR_GREEN); + g_free(otrtrusted_val); + + gchar *otruntrusted_val = g_key_file_get_string(theme, "colours", "otr.untrusted", NULL); + _set_colour(otruntrusted_val, &colour_prefs.otruntrusted, COLOR_YELLOW); + g_free(otruntrusted_val); + gchar *online_val = g_key_file_get_string(theme, "colours", "online", NULL); _set_colour(online_val, &colour_prefs.online, COLOR_GREEN); g_free(online_val); diff --git a/src/config/theme.h b/src/config/theme.h index b7f26f3f..89569882 100644 --- a/src/config/theme.h +++ b/src/config/theme.h @@ -32,35 +32,40 @@ #include #endif -#define COLOUR_TEXT COLOR_PAIR(1) -#define COLOUR_SPLASH COLOR_PAIR(2) -#define COLOUR_ERROR COLOR_PAIR(3) -#define COLOUR_INCOMING COLOR_PAIR(4) -#define COLOUR_INPUT_TEXT COLOR_PAIR(5) -#define COLOUR_TIME COLOR_PAIR(6) -#define COLOUR_TITLE_TEXT COLOR_PAIR(10) -#define COLOUR_TITLE_BRACKET COLOR_PAIR(11) -#define COLOUR_TITLE_UNENCRYPTED COLOR_PAIR(12) -#define COLOUR_TITLE_ENCRYPTED COLOR_PAIR(13) -#define COLOUR_TITLE_UNTRUSTED COLOR_PAIR(14) -#define COLOUR_TITLE_TRUSTED COLOR_PAIR(15) -#define COLOUR_STATUS_TEXT COLOR_PAIR(20) -#define COLOUR_STATUS_BRACKET COLOR_PAIR(21) -#define COLOUR_STATUS_ACTIVE COLOR_PAIR(22) -#define COLOUR_STATUS_NEW COLOR_PAIR(23) -#define COLOUR_ME COLOR_PAIR(30) -#define COLOUR_THEM COLOR_PAIR(31) -#define COLOUR_ROOMINFO COLOR_PAIR(40) -#define COLOUR_ONLINE COLOR_PAIR(50) -#define COLOUR_OFFLINE COLOR_PAIR(51) -#define COLOUR_AWAY COLOR_PAIR(52) -#define COLOUR_CHAT COLOR_PAIR(53) -#define COLOUR_DND COLOR_PAIR(54) -#define COLOUR_XA COLOR_PAIR(55) -#define COLOUR_TYPING COLOR_PAIR(60) -#define COLOUR_GONE COLOR_PAIR(61) -#define COLOUR_SUBSCRIBED COLOR_PAIR(70) -#define COLOUR_UNSUBSCRIBED COLOR_PAIR(71) +#define COLOUR_TEXT COLOR_PAIR(1) +#define COLOUR_SPLASH COLOR_PAIR(2) +#define COLOUR_ERROR COLOR_PAIR(3) +#define COLOUR_INCOMING COLOR_PAIR(4) +#define COLOUR_INPUT_TEXT COLOR_PAIR(5) +#define COLOUR_TIME COLOR_PAIR(6) +#define COLOUR_TITLE_TEXT COLOR_PAIR(7) +#define COLOUR_TITLE_BRACKET COLOR_PAIR(8) +#define COLOUR_TITLE_UNENCRYPTED COLOR_PAIR(9) +#define COLOUR_TITLE_ENCRYPTED COLOR_PAIR(10) +#define COLOUR_TITLE_UNTRUSTED COLOR_PAIR(11) +#define COLOUR_TITLE_TRUSTED COLOR_PAIR(12) +#define COLOUR_STATUS_TEXT COLOR_PAIR(13) +#define COLOUR_STATUS_BRACKET COLOR_PAIR(14) +#define COLOUR_STATUS_ACTIVE COLOR_PAIR(15) +#define COLOUR_STATUS_NEW COLOR_PAIR(16) +#define COLOUR_ME COLOR_PAIR(17) +#define COLOUR_THEM COLOR_PAIR(18) +#define COLOUR_ROOMINFO COLOR_PAIR(19) +#define COLOUR_ONLINE COLOR_PAIR(20) +#define COLOUR_OFFLINE COLOR_PAIR(21) +#define COLOUR_AWAY COLOR_PAIR(22) +#define COLOUR_CHAT COLOR_PAIR(23) +#define COLOUR_DND COLOR_PAIR(24) +#define COLOUR_XA COLOR_PAIR(25) +#define COLOUR_TYPING COLOR_PAIR(26) +#define COLOUR_GONE COLOR_PAIR(27) +#define COLOUR_SUBSCRIBED COLOR_PAIR(28) +#define COLOUR_UNSUBSCRIBED COLOR_PAIR(29) +#define COLOUR_OTR_STARTED_TRUSTED COLOR_PAIR(30) +#define COLOUR_OTR_STARTED_UNTRUSTED COLOR_PAIR(31) +#define COLOUR_OTR_ENDED COLOR_PAIR(32) +#define COLOUR_OTR_TRUSTED COLOR_PAIR(33) +#define COLOUR_OTR_UNTRUSTED COLOR_PAIR(34) void theme_init(const char * const theme_name); void theme_init_colours(void); -- cgit 1.4.1-2-gfad0