1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

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
This commit is contained in:
Michael Vetter 2019-12-19 18:53:22 +01:00
parent c302af99b7
commit 0af54d8a72
5 changed files with 22 additions and 0 deletions

View File

@ -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);

View File

@ -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." },

View File

@ -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");

View File

@ -1711,6 +1711,7 @@ _get_group(preference_t pref)
case PREF_CONSOLE_PRIVATE:
case PREF_CONSOLE_CHAT:
case PREF_COLOR_NICK:
case PREF_ROSTER_COLOR_NICK:
case PREF_STATUSBAR_SHOW_NAME:
case PREF_STATUSBAR_SHOW_NUMBER:
case PREF_STATUSBAR_SELF:
@ -1972,6 +1973,8 @@ _get_key(preference_t pref)
return "console.chat";
case PREF_COLOR_NICK:
return "color.nick";
case PREF_ROSTER_COLOR_NICK:
return "color.roster.nick";
case PREF_BOOKMARK_INVITE:
return "bookmark.invite";
case PREF_PLUGINS_SOURCEPATH:

View File

@ -1989,6 +1989,12 @@ cons_color_setting(void)
}
prefs_free_string(color_pref);
if (prefs_get_boolean(PREF_ROSTER_COLOR_NICK)) {
cons_show("Consistent color generation in roster (/roster) : ON");
} else {
cons_show("Consistent color generation in roster (/roster) : OFF");
}
}
void