Added /roster char contact

This commit is contained in:
James Booth
2015-11-20 00:06:46 +00:00
parent 3f18c8c35d
commit 16fbdedceb
10 changed files with 83 additions and 0 deletions

View File

@@ -279,6 +279,7 @@ static struct cmd_t command_defs[] =
"/roster by group|presence|none",
"/roster order name|presence",
"/roster char header <char>|none",
"/roster char contact <char>|none",
"/roster size <percent>",
"/roster add <jid> [<nick>]",
"/roster remove <jid>",
@@ -313,6 +314,8 @@ static struct cmd_t command_defs[] =
{ "order presence", "Order roster items by presence, and then by name." },
{ "char header <char>", "Prefix roster headers with specificed character." },
{ "char header none", "Remove roster header character prefix." },
{ "char contact <char>", "Prefix roster contacts with specificed character." },
{ "char contact none", "Remove roster contact character prefix." },
{ "size <precent>", "Percentage of the screen taken up by the roster (1-99)." },
{ "add <jid> [<nick>]", "Add a new item to the roster." },
{ "remove <jid>", "Removes an item from the roster." },
@@ -2033,6 +2036,7 @@ cmd_init(void)
roster_char_ac = autocomplete_new();
autocomplete_add(roster_char_ac, "header");
autocomplete_add(roster_char_ac, "contact");
roster_char_none_ac = autocomplete_new();
autocomplete_add(roster_char_none_ac, "none");
@@ -2890,6 +2894,10 @@ _roster_autocomplete(ProfWin *window, const char *const input)
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster char contact", roster_char_none_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete);
if (result) {
return result;

View File

@@ -1764,6 +1764,18 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_show("Roster header char set to %c.", args[2][0]);
rosterwin_roster();
}
} else if (g_strcmp0(args[1], "contact") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else if (g_strcmp0(args[2], "none") == 0) {
prefs_clear_roster_contact_char();
cons_show("Roster contact char removed.");
rosterwin_roster();
} else {
prefs_set_roster_contact_char(args[2][0]);
cons_show("Roster contact char set to %c.", args[2][0]);
rosterwin_roster();
}
} else {
cons_bad_cmd_usage(command);
}