diff options
| author | Michael Vetter <jubalh@iodoru.org> | 2019-12-19 19:14:59 +0100 |
|---|---|---|
| committer | Michael Vetter <jubalh@iodoru.org> | 2019-12-19 19:14:59 +0100 |
| commit | 808850c6f5c85b0e173e922b9979ca3a09b4dc31 (patch) | |
| tree | ef37d004827224fe8662b3b850d21888a950a230 /src/command | |
| parent | 6d82020a66505e9c58b26091684e5f78ac71d210 (diff) | |
| download | profani-tty-808850c6f5c85b0e173e922b9979ca3a09b4dc31.tar.gz | |
Add /occupants color command
`/occupants color on|off` to enable or disable XEP-0392 also for the
MUC occupants.
Regards
https://github.com/profanity-im/profanity/issues/1191
Diffstat (limited to 'src/command')
| -rw-r--r-- | src/command/cmd_ac.c | 6 | ||||
| -rw-r--r-- | src/command/cmd_defs.c | 3 | ||||
| -rw-r--r-- | src/command/cmd_funcs.c | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index d67e8aff..7950c811 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -708,6 +708,7 @@ cmd_ac_init(void) autocomplete_add(occupants_ac, "header"); autocomplete_add(occupants_ac, "wrap"); autocomplete_add(occupants_ac, "char"); + autocomplete_add(occupants_ac, "color"); occupants_default_ac = autocomplete_new(); autocomplete_add(occupants_default_ac, "show"); @@ -2651,6 +2652,11 @@ _occupants_autocomplete(ProfWin *window, const char *const input, gboolean previ return found; } + found = autocomplete_param_with_func(input, "/occupants color", prefs_autocomplete_boolean_choice, previous); + if (found) { + return found; + } + found = autocomplete_param_with_ac(input, "/occupants default hide", occupants_show_ac, TRUE, previous); if (found) { return found; diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 38547bbd..17b9d6cb 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -714,6 +714,7 @@ static struct cmd_t command_defs[] = CMD_SYN( "/occupants show|hide [jid]", "/occupants char <char>|none", + "/occupants color on|off", "/occupants default show|hide [jid]", "/occupants size [<percent>]", "/occupants indent <indent>", @@ -725,6 +726,8 @@ static struct cmd_t command_defs[] = { "show", "Show the occupants panel in current room." }, { "char <char>", "Prefix occupants with specified character." }, { "char none", "Remove occupants character prefix." }, + { "color on", "Enable generated color names (XEP-0392) for occupants" }, + { "color off", "Disable generated color names (XEP-0392) for occupants" }, { "hide", "Hide the occupants panel in current room." }, { "show jid", "Show jid in the occupants panel in current room." }, { "hide jid", "Hide jid in the occupants panel in current room." }, diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index d55bc762..aa1f21c3 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -4442,6 +4442,12 @@ cmd_occupants(ProfWin *window, const char *const command, gchar **args) return TRUE; } + if (g_strcmp0(args[0], "color") == 0) { + _cmd_set_boolean_preference(args[1], command, "Occupants consistent colors", PREF_OCCUPANTS_COLOR_NICK); + occupantswin_occupants_all(); + return TRUE; + } + if (g_strcmp0(args[0], "default") == 0) { if (g_strcmp0(args[1], "show") == 0) { if (g_strcmp0(args[2], "jid") == 0) { |