Added /roster indent resource

This commit is contained in:
James Booth
2015-11-21 21:49:12 +00:00
parent f54c2e8eca
commit ef0f093efd
6 changed files with 141 additions and 83 deletions

View File

@@ -281,6 +281,7 @@ static struct cmd_t command_defs[] =
"/roster char header <char>|none",
"/roster char contact <char>|none",
"/roster indent contact <indent>",
"/roster indent resource <indent>",
"/roster size <percent>",
"/roster add <jid> [<nick>]",
"/roster remove <jid>",
@@ -318,6 +319,7 @@ static struct cmd_t command_defs[] =
{ "char contact <char>", "Prefix roster contacts with specificed character." },
{ "char contact none", "Remove roster contact character prefix." },
{ "indent contact <indent>", "Indent contact line by <indent> spaces." },
{ "indent resource <indent>", "Indent roster line by <indent> spaces." },
{ "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." },
@@ -2047,6 +2049,7 @@ cmd_init(void)
roster_indent_ac = autocomplete_new();
autocomplete_add(roster_indent_ac, "contact");
autocomplete_add(roster_indent_ac, "resource");
roster_option_ac = autocomplete_new();
autocomplete_add(roster_option_ac, "offline");

View File

@@ -1799,6 +1799,22 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
free(err_msg);
}
}
} else if (g_strcmp0(args[1], "resource") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else {
int intval = 0;
char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, 0, 10, &err_msg);
if (res) {
prefs_set_roster_resource_indent(intval);
cons_show("Roster resource indent set to: %d", intval);
rosterwin_roster();
} else {
cons_show(err_msg);
free(err_msg);
}
}
} else {
cons_bad_cmd_usage(command);
}