about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/config/theme.c80
-rw-r--r--src/config/theme.h63
-rw-r--r--src/ui/core.c12
3 files changed, 98 insertions, 57 deletions
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 <ncurses.h>
 #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);
diff --git a/src/ui/core.c b/src/ui/core.c
index 2243bd65..10276c4b 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -586,7 +586,11 @@ _ui_gone_secure(const char * const recipient, gboolean trusted)
     if (window != NULL) {
         window->is_otr = TRUE;
         window->is_trusted = trusted;
-        win_vprint_line(window, '!', 0, "OTR session started.");
+        if (trusted) {
+            win_vprint_line(window, '!', COLOUR_OTR_STARTED_TRUSTED, "OTR session started (trusted).");
+        } else {
+            win_vprint_line(window, '!', COLOUR_OTR_STARTED_UNTRUSTED, "OTR session started (untrusted).");
+        }
 
         if (wins_is_current(window)) {
             GString *recipient_str = _get_recipient_string(window);
@@ -604,7 +608,7 @@ _ui_gone_insecure(const char * const recipient)
     if (window != NULL) {
         window->is_otr = FALSE;
         window->is_trusted = FALSE;
-        win_vprint_line(window, '!', 0, "OTR session ended.");
+        win_vprint_line(window, '!', COLOUR_OTR_ENDED, "OTR session ended.");
 
         if (wins_is_current(window)) {
             GString *recipient_str = _get_recipient_string(window);
@@ -622,7 +626,7 @@ _ui_trust(const char * const recipient)
     if (window != NULL) {
         window->is_otr = TRUE;
         window->is_trusted = TRUE;
-        win_vprint_line(window, '!', 0, "OTR session trusted.");
+        win_vprint_line(window, '!', COLOUR_OTR_TRUSTED, "OTR session trusted.");
 
         if (wins_is_current(window)) {
             GString *recipient_str = _get_recipient_string(window);
@@ -640,7 +644,7 @@ _ui_untrust(const char * const recipient)
     if (window != NULL) {
         window->is_otr = TRUE;
         window->is_trusted = FALSE;
-        win_vprint_line(window, '!', 0, "OTR session untrusted.");
+        win_vprint_line(window, '!', COLOUR_OTR_UNTRUSTED, "OTR session untrusted.");
 
         if (wins_is_current(window)) {
             GString *recipient_str = _get_recipient_string(window);