about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c26
-rw-r--r--src/command/cmd_defs.c11
-rw-r--r--src/command/cmd_funcs.c29
3 files changed, 60 insertions, 6 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 625afd99..8908777a 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -111,6 +111,7 @@ static char* _clear_autocomplete(ProfWin *window, const char *const input, gbool
 static char* _invite_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _status_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _logging_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _color_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 
 static char* _script_autocomplete_func(const char *const prefix, gboolean previous);
 
@@ -229,6 +230,7 @@ static Autocomplete invite_ac;
 static Autocomplete status_ac;
 static Autocomplete status_state_ac;
 static Autocomplete logging_ac;
+static Autocomplete color_ac;
 
 void
 cmd_ac_init(void)
@@ -903,6 +905,12 @@ cmd_ac_init(void)
     logging_ac = autocomplete_new();
     autocomplete_add(logging_ac, "chat");
     autocomplete_add(logging_ac, "group");
+
+    color_ac = autocomplete_new();
+    autocomplete_add(color_ac, "on");
+    autocomplete_add(color_ac, "off");
+    autocomplete_add(color_ac, "redgreen");
+    autocomplete_add(color_ac, "blue");
 }
 
 void
@@ -1205,6 +1213,7 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(status_ac);
     autocomplete_reset(status_state_ac);
     autocomplete_reset(logging_ac);
+    autocomplete_reset(color_ac);
 
     autocomplete_reset(script_ac);
     if (script_show_ac) {
@@ -1349,6 +1358,7 @@ cmd_ac_uninit(void)
     autocomplete_free(status_ac);
     autocomplete_free(status_state_ac);
     autocomplete_free(logging_ac);
+    autocomplete_free(color_ac);
 }
 
 static void
@@ -1479,7 +1489,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
 
     // autocomplete boolean settings
     gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
-        "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity", "/color" };
+        "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity"};
 
     for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
         result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous);
@@ -1597,6 +1607,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
     g_hash_table_insert(ac_funcs, "/invite",        _invite_autocomplete);
     g_hash_table_insert(ac_funcs, "/status",        _status_autocomplete);
     g_hash_table_insert(ac_funcs, "/logging",       _logging_autocomplete);
+    g_hash_table_insert(ac_funcs, "/color",         _color_autocomplete);
 
     int len = strlen(input);
     char parsed[len+1];
@@ -3595,3 +3606,16 @@ _logging_autocomplete(ProfWin *window, const char *const input, gboolean previou
 
     return NULL;
 }
+
+static char*
+_color_autocomplete(ProfWin *window, const char *const input, gboolean previous)
+{
+    char *result = NULL;
+
+    result = autocomplete_param_with_ac(input, "/color", color_ac, TRUE, previous);
+    if (result) {
+        return result;
+    }
+
+    return NULL;
+}
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 0ea47bca..7e0001c6 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2302,12 +2302,15 @@ static struct cmd_t command_defs[] =
         CMD_TAGS(
             CMD_TAG_UI)
         CMD_SYN(
-            "/color on|off")
+            "/color on|off|redgreen|blue")
         CMD_DESC(
-            "Settings for consistent color generation for nicks (XEP-0392).")
+            "Settings for consistent color generation for nicks (XEP-0392). Including corrections for Color Vision Deficiencies")
         CMD_ARGS(
-            { "on|off", "Enable or disable nick colorization for MUC nicks." })
-        CMD_NOEXAMPLES
+            { "on|off|redgreen|blue", "Enable or disable nick colorization for MUC nicks. 'redgreen' is for people with red/green blindess and 'blue' for people with blue blindness."})
+        CMD_EXAMPLES(
+            "/color off",
+            "/color on",
+            "/color blue")
     },
 };
 
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 2b7894ad..425b50fc 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -8630,6 +8630,33 @@ cmd_paste(ProfWin *window, const char *const command, gchar **args)
 gboolean
 cmd_color(ProfWin *window, const char *const command, gchar **args)
 {
-    _cmd_set_boolean_preference(args[0], command, "Consistent color generation for nicks", PREF_COLOR_NICK);
+    if (g_strcmp0(args[0], "on") == 0) {
+            prefs_set_string(PREF_COLOR_NICK, "true");
+    } else if (g_strcmp0(args[0], "off") == 0) {
+            prefs_set_string(PREF_COLOR_NICK, "false");
+    } else if (g_strcmp0(args[0], "redgreen") == 0) {
+            prefs_set_string(PREF_COLOR_NICK, "redgreen");
+    } else if (g_strcmp0(args[0], "blue") == 0) {
+            prefs_set_string(PREF_COLOR_NICK, "blue");
+    } else {
+        cons_bad_cmd_usage(command);
+        return TRUE;
+    }
+
+    cons_show("Consistent color generation for nicks set to: %s", args[0]);
+
+    char *theme = prefs_get_string(PREF_THEME);
+    if (theme) {
+        gboolean res = theme_load(theme);
+
+        if (res) {
+            cons_show("Theme reloaded: %s", theme);
+        } else {
+            theme_load("default");
+        }
+
+        prefs_free_string(theme);
+    }
+
     return TRUE;
 }