about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-07 22:38:34 +0000
committerJames Booth <boothj5@gmail.com>2014-11-07 22:38:34 +0000
commit373b3a2d7c493200207201f5bd3ec185a9207fa1 (patch)
tree256f57c3c4f411d7a3acdc058e0e07cb822d4f88 /src/config
parent571db231509577fe1e528595c3aae61e2f8ccf3f (diff)
downloadprofani-tty-373b3a2d7c493200207201f5bd3ec185a9207fa1.tar.gz
Added /presence command to show contacts presence
Diffstat (limited to 'src/config')
-rw-r--r--src/config/preferences.c4
-rw-r--r--src/config/preferences.h1
-rw-r--r--src/config/theme.c82
-rw-r--r--src/config/theme.h52
4 files changed, 93 insertions, 46 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 9f084951..1447160b 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -451,6 +451,7 @@ _get_group(preference_t pref)
         case PREF_STATUSES_CHAT:
         case PREF_STATUSES_MUC:
         case PREF_MUC_PRIVILEGES:
+        case PREF_PRESENCE:
             return PREF_GROUP_UI;
         case PREF_STATES:
         case PREF_OUTTYPE:
@@ -567,6 +568,8 @@ _get_key(preference_t pref)
             return "rotate";
         case PREF_LOG_SHARED:
             return "shared";
+        case PREF_PRESENCE:
+            return "presence";
         default:
             return NULL;
     }
@@ -588,6 +591,7 @@ _get_default_boolean(preference_t pref)
         case PREF_SPLASH:
         case PREF_OCCUPANTS:
         case PREF_MUC_PRIVILEGES:
+        case PREF_PRESENCE:
             return TRUE;
         default:
             return FALSE;
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 528d9661..a4dfa1f1 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -59,6 +59,7 @@ typedef enum {
     PREF_MOUSE,
     PREF_OCCUPANTS,
     PREF_MUC_PRIVILEGES,
+    PREF_PRESENCE,
     PREF_STATUSES,
     PREF_STATUSES_CONSOLE,
     PREF_STATUSES_CHAT,
diff --git a/src/config/theme.c b/src/config/theme.c
index b3b70db7..b79d3070 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -80,6 +80,12 @@ static struct colours_t {
         NCURSES_COLOR_T titlebarencrypted;
         NCURSES_COLOR_T titlebaruntrusted;
         NCURSES_COLOR_T titlebartrusted;
+        NCURSES_COLOR_T titlebaronline;
+        NCURSES_COLOR_T titlebaroffline;
+        NCURSES_COLOR_T titlebaraway;
+        NCURSES_COLOR_T titlebarxa;
+        NCURSES_COLOR_T titlebardnd;
+        NCURSES_COLOR_T titlebarchat;
         NCURSES_COLOR_T statusbartext;
         NCURSES_COLOR_T statusbarbrackets;
         NCURSES_COLOR_T statusbaractive;
@@ -206,43 +212,49 @@ theme_init_colours(void)
     init_pair(12, colour_prefs.titlebarencrypted, colour_prefs.titlebar);
     init_pair(13, colour_prefs.titlebaruntrusted, colour_prefs.titlebar);
     init_pair(14, colour_prefs.titlebartrusted, colour_prefs.titlebar);
+    init_pair(15, colour_prefs.titlebaronline, colour_prefs.titlebar);
+    init_pair(16, colour_prefs.titlebaroffline, colour_prefs.titlebar);
+    init_pair(17, colour_prefs.titlebaraway, colour_prefs.titlebar);
+    init_pair(18, colour_prefs.titlebarchat, colour_prefs.titlebar);
+    init_pair(19, colour_prefs.titlebardnd, colour_prefs.titlebar);
+    init_pair(20, colour_prefs.titlebarxa, colour_prefs.titlebar);
 
     // status bar
-    init_pair(15, colour_prefs.statusbartext, colour_prefs.statusbar);
-    init_pair(16, colour_prefs.statusbarbrackets, colour_prefs.statusbar);
-    init_pair(17, colour_prefs.statusbaractive, colour_prefs.statusbar);
-    init_pair(18, colour_prefs.statusbarnew, colour_prefs.statusbar);
+    init_pair(21, colour_prefs.statusbartext, colour_prefs.statusbar);
+    init_pair(22, colour_prefs.statusbarbrackets, colour_prefs.statusbar);
+    init_pair(23, colour_prefs.statusbaractive, colour_prefs.statusbar);
+    init_pair(24, colour_prefs.statusbarnew, colour_prefs.statusbar);
 
     // chat
-    init_pair(19, colour_prefs.me, colour_prefs.bkgnd);
-    init_pair(20, colour_prefs.them, colour_prefs.bkgnd);
+    init_pair(25, colour_prefs.me, colour_prefs.bkgnd);
+    init_pair(26, colour_prefs.them, colour_prefs.bkgnd);
 
     // room chat
-    init_pair(21, colour_prefs.roominfo, colour_prefs.bkgnd);
-    init_pair(22, colour_prefs.roommention, colour_prefs.bkgnd);
+    init_pair(27, colour_prefs.roominfo, colour_prefs.bkgnd);
+    init_pair(28, colour_prefs.roommention, colour_prefs.bkgnd);
 
     // statuses
-    init_pair(23, colour_prefs.online, colour_prefs.bkgnd);
-    init_pair(24, colour_prefs.offline, colour_prefs.bkgnd);
-    init_pair(25, colour_prefs.away, colour_prefs.bkgnd);
-    init_pair(26, colour_prefs.chat, colour_prefs.bkgnd);
-    init_pair(27, colour_prefs.dnd, colour_prefs.bkgnd);
-    init_pair(28, colour_prefs.xa, colour_prefs.bkgnd);
+    init_pair(29, colour_prefs.online, colour_prefs.bkgnd);
+    init_pair(30, colour_prefs.offline, colour_prefs.bkgnd);
+    init_pair(31, colour_prefs.away, colour_prefs.bkgnd);
+    init_pair(32, colour_prefs.chat, colour_prefs.bkgnd);
+    init_pair(33, colour_prefs.dnd, colour_prefs.bkgnd);
+    init_pair(34, colour_prefs.xa, colour_prefs.bkgnd);
 
     // states
-    init_pair(29, colour_prefs.typing, colour_prefs.bkgnd);
-    init_pair(30, colour_prefs.gone, colour_prefs.bkgnd);
+    init_pair(35, colour_prefs.typing, colour_prefs.bkgnd);
+    init_pair(36, colour_prefs.gone, colour_prefs.bkgnd);
 
     // subscription status
-    init_pair(31, colour_prefs.subscribed, colour_prefs.bkgnd);
-    init_pair(32, colour_prefs.unsubscribed, colour_prefs.bkgnd);
+    init_pair(37, colour_prefs.subscribed, colour_prefs.bkgnd);
+    init_pair(38, colour_prefs.unsubscribed, colour_prefs.bkgnd);
 
     // otr messages
-    init_pair(33, colour_prefs.otrstartedtrusted, colour_prefs.bkgnd);
-    init_pair(34, colour_prefs.otrstarteduntrusted, colour_prefs.bkgnd);
-    init_pair(35, colour_prefs.otrended, colour_prefs.bkgnd);
-    init_pair(36, colour_prefs.otrtrusted, colour_prefs.bkgnd);
-    init_pair(37, colour_prefs.otruntrusted, colour_prefs.bkgnd);
+    init_pair(39, colour_prefs.otrstartedtrusted, colour_prefs.bkgnd);
+    init_pair(40, colour_prefs.otrstarteduntrusted, colour_prefs.bkgnd);
+    init_pair(41, colour_prefs.otrended, colour_prefs.bkgnd);
+    init_pair(42, colour_prefs.otrtrusted, colour_prefs.bkgnd);
+    init_pair(43, colour_prefs.otruntrusted, colour_prefs.bkgnd);
 }
 
 static NCURSES_COLOR_T
@@ -313,6 +325,30 @@ _load_colours(void)
     _set_colour(titlebartrusted_val, &colour_prefs.titlebartrusted, COLOR_WHITE);
     g_free(titlebartrusted_val);
 
+    gchar *titlebaronline_val = g_key_file_get_string(theme, "colours", "titlebar.online", NULL);
+    _set_colour(titlebaronline_val, &colour_prefs.titlebaronline, COLOR_WHITE);
+    g_free(titlebaronline_val);
+
+    gchar *titlebaroffline_val = g_key_file_get_string(theme, "colours", "titlebar.offline", NULL);
+    _set_colour(titlebaroffline_val, &colour_prefs.titlebaroffline, COLOR_WHITE);
+    g_free(titlebaroffline_val);
+
+    gchar *titlebaraway_val = g_key_file_get_string(theme, "colours", "titlebar.away", NULL);
+    _set_colour(titlebaraway_val, &colour_prefs.titlebaraway, COLOR_WHITE);
+    g_free(titlebaraway_val);
+
+    gchar *titlebarchat_val = g_key_file_get_string(theme, "colours", "titlebar.chat", NULL);
+    _set_colour(titlebarchat_val, &colour_prefs.titlebarchat, COLOR_WHITE);
+    g_free(titlebarchat_val);
+
+    gchar *titlebardnd_val = g_key_file_get_string(theme, "colours", "titlebar.dnd", NULL);
+    _set_colour(titlebardnd_val, &colour_prefs.titlebardnd, COLOR_WHITE);
+    g_free(titlebardnd_val);
+
+    gchar *titlebarxa_val = g_key_file_get_string(theme, "colours", "titlebar.xa", NULL);
+    _set_colour(titlebarxa_val, &colour_prefs.titlebarxa, COLOR_WHITE);
+    g_free(titlebarxa_val);
+
     gchar *statusbartext_val = g_key_file_get_string(theme, "colours", "statusbar.text", NULL);
     _set_colour(statusbartext_val, &colour_prefs.statusbartext, COLOR_WHITE);
     g_free(statusbartext_val);
diff --git a/src/config/theme.h b/src/config/theme.h
index b3d96681..4424807a 100644
--- a/src/config/theme.h
+++ b/src/config/theme.h
@@ -58,29 +58,35 @@
 #define COLOUR_TITLE_ENCRYPTED          COLOR_PAIR(12)
 #define COLOUR_TITLE_UNTRUSTED          COLOR_PAIR(13)
 #define COLOUR_TITLE_TRUSTED            COLOR_PAIR(14)
-#define COLOUR_STATUS_TEXT              COLOR_PAIR(15)
-#define COLOUR_STATUS_BRACKET           COLOR_PAIR(16)
-#define COLOUR_STATUS_ACTIVE            COLOR_PAIR(17)
-#define COLOUR_STATUS_NEW               COLOR_PAIR(18)
-#define COLOUR_ME                       COLOR_PAIR(19)
-#define COLOUR_THEM                     COLOR_PAIR(20)
-#define COLOUR_ROOMINFO                 COLOR_PAIR(21)
-#define COLOUR_ROOMMENTION              COLOR_PAIR(22)
-#define COLOUR_ONLINE                   COLOR_PAIR(23)
-#define COLOUR_OFFLINE                  COLOR_PAIR(24)
-#define COLOUR_AWAY                     COLOR_PAIR(25)
-#define COLOUR_CHAT                     COLOR_PAIR(26)
-#define COLOUR_DND                      COLOR_PAIR(27)
-#define COLOUR_XA                       COLOR_PAIR(28)
-#define COLOUR_TYPING                   COLOR_PAIR(29)
-#define COLOUR_GONE                     COLOR_PAIR(30)
-#define COLOUR_SUBSCRIBED               COLOR_PAIR(31)
-#define COLOUR_UNSUBSCRIBED             COLOR_PAIR(32)
-#define COLOUR_OTR_STARTED_TRUSTED      COLOR_PAIR(33)
-#define COLOUR_OTR_STARTED_UNTRUSTED    COLOR_PAIR(34)
-#define COLOUR_OTR_ENDED                COLOR_PAIR(35)
-#define COLOUR_OTR_TRUSTED              COLOR_PAIR(36)
-#define COLOUR_OTR_UNTRUSTED            COLOR_PAIR(37)
+#define COLOUR_TITLE_ONLINE             COLOR_PAIR(15)
+#define COLOUR_TITLE_OFFLINE            COLOR_PAIR(16)
+#define COLOUR_TITLE_AWAY               COLOR_PAIR(17)
+#define COLOUR_TITLE_CHAT               COLOR_PAIR(18)
+#define COLOUR_TITLE_DND                COLOR_PAIR(19)
+#define COLOUR_TITLE_XA                 COLOR_PAIR(20)
+#define COLOUR_STATUS_TEXT              COLOR_PAIR(21)
+#define COLOUR_STATUS_BRACKET           COLOR_PAIR(22)
+#define COLOUR_STATUS_ACTIVE            COLOR_PAIR(23)
+#define COLOUR_STATUS_NEW               COLOR_PAIR(24)
+#define COLOUR_ME                       COLOR_PAIR(25)
+#define COLOUR_THEM                     COLOR_PAIR(26)
+#define COLOUR_ROOMINFO                 COLOR_PAIR(27)
+#define COLOUR_ROOMMENTION              COLOR_PAIR(28)
+#define COLOUR_ONLINE                   COLOR_PAIR(29)
+#define COLOUR_OFFLINE                  COLOR_PAIR(30)
+#define COLOUR_AWAY                     COLOR_PAIR(31)
+#define COLOUR_CHAT                     COLOR_PAIR(32)
+#define COLOUR_DND                      COLOR_PAIR(33)
+#define COLOUR_XA                       COLOR_PAIR(34)
+#define COLOUR_TYPING                   COLOR_PAIR(35)
+#define COLOUR_GONE                     COLOR_PAIR(36)
+#define COLOUR_SUBSCRIBED               COLOR_PAIR(37)
+#define COLOUR_UNSUBSCRIBED             COLOR_PAIR(38)
+#define COLOUR_OTR_STARTED_TRUSTED      COLOR_PAIR(39)
+#define COLOUR_OTR_STARTED_UNTRUSTED    COLOR_PAIR(40)
+#define COLOUR_OTR_ENDED                COLOR_PAIR(41)
+#define COLOUR_OTR_TRUSTED              COLOR_PAIR(42)
+#define COLOUR_OTR_UNTRUSTED            COLOR_PAIR(43)
 
 void theme_init(const char * const theme_name);
 void theme_init_colours(void);