aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-12-19 18:53:22 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-12-19 18:53:22 +0100
commit0af54d8a72c0c218e5fa847e61a5c98589662b79 (patch)
treeb6ebf24c8fcab9a8cabbdb307f682ecd632ac6e1 /src/command
parentc302af99b757257d07ebebc97cd2de0a516754e2 (diff)
downloadprofani-tty-0af54d8a72c0c218e5fa847e61a5c98589662b79.tar.gz
Add /roster color command
`/roster color on|off` to enable or disable XEP-0392 also for the roster. Regards https://github.com/profanity-im/profanity/issues/1191
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c5
-rw-r--r--src/command/cmd_defs.c3
-rw-r--r--src/command/cmd_funcs.c5
3 files changed, 13 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 9399aa8d..d67e8aff 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -433,6 +433,7 @@ cmd_ac_init(void)
autocomplete_add(roster_ac, "hide");
autocomplete_add(roster_ac, "by");
autocomplete_add(roster_ac, "count");
+ autocomplete_add(roster_ac, "color");
autocomplete_add(roster_ac, "order");
autocomplete_add(roster_ac, "unread");
autocomplete_add(roster_ac, "room");
@@ -1821,6 +1822,10 @@ _roster_autocomplete(ProfWin *window, const char *const input, gboolean previous
if (result) {
return result;
}
+ result = autocomplete_param_with_func(input, "/roster color", prefs_autocomplete_boolean_choice, previous);
+ if (result) {
+ return result;
+ }
}
result = autocomplete_param_with_ac(input, "/roster remove_all", roster_remove_all_ac, TRUE, previous);
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index a1dde57b..38547bbd 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -280,6 +280,7 @@ static struct cmd_t command_defs[] =
"/roster by group|presence|none",
"/roster count unread|items|off",
"/roster count zero on|off",
+ "/roster color on|off",
"/roster order name|presence",
"/roster unread before|after|off",
"/roster room char <char>|none",
@@ -341,6 +342,8 @@ static struct cmd_t command_defs[] =
{ "count off", "Do not show any count with roster headers." },
{ "count zero on", "Show roster header count when 0." },
{ "count zero off", "Hide roster header count when 0." },
+ { "color on", "Enable generated color names (XEP-0392)" },
+ { "color off", "Disable generated color names (XEP-0392)" },
{ "order name", "Order roster contacts by name only." },
{ "order presence", "Order roster contacts by presence, and then by name." },
{ "unread before", "Show unread message count before contact." },
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 2b9acb02..d55bc762 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -2739,6 +2739,11 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
+ } else if (g_strcmp0(args[0], "color") == 0) {
+ _cmd_set_boolean_preference(args[1], command, "Roster consistent colors", PREF_ROSTER_COLOR_NICK);
+ ui_show_roster();
+ return TRUE;
+
} else if (g_strcmp0(args[0], "unread") == 0) {
if (g_strcmp0(args[1], "before") == 0) {
cons_show("Roster unread message count: before");