diff options
author | James Booth <boothj5@gmail.com> | 2015-11-22 02:04:59 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-11-22 02:04:59 +0000 |
commit | c4e8af0b6dfbb787ab29e52d63845d48e01aef2d (patch) | |
tree | d1469f69cc34d340d0aa67be0fe5886b355f60d4 /src/command | |
parent | fade5469df19c217c06c73cd28f3b3eb0576d749 (diff) | |
download | profani-tty-c4e8af0b6dfbb787ab29e52d63845d48e01aef2d.tar.gz |
Added /roster char resource
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 8 | ||||
-rw-r--r-- | src/command/commands.c | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index d3895247..c80ce2b4 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -280,6 +280,7 @@ static struct cmd_t command_defs[] = "/roster order name|presence", "/roster char header <char>|none", "/roster char contact <char>|none", + "/roster char resource <char>|none", "/roster indent contact <indent>", "/roster indent resource <indent>", "/roster indent presence <indent>", @@ -320,6 +321,8 @@ static struct cmd_t command_defs[] = { "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." }, + { "char resource <char>", "Prefix roster resources with specificed character." }, + { "char resource none", "Remove roster resource character prefix." }, { "indent contact <indent>", "Indent contact line by <indent> spaces (0 to 10)." }, { "indent resource <indent>", "Indent resource line by <indent> spaces (0 to 10)." }, { "indent presence <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." }, @@ -2048,6 +2051,7 @@ cmd_init(void) roster_char_ac = autocomplete_new(); autocomplete_add(roster_char_ac, "header"); autocomplete_add(roster_char_ac, "contact"); + autocomplete_add(roster_char_ac, "resource"); roster_char_none_ac = autocomplete_new(); autocomplete_add(roster_char_none_ac, "none"); @@ -2916,6 +2920,10 @@ _roster_autocomplete(ProfWin *window, const char *const input) if (result) { return result; } + result = autocomplete_param_with_ac(input, "/roster char resource", roster_char_none_ac, TRUE); + if (result) { + return result; + } result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete); if (result) { return result; diff --git a/src/command/commands.c b/src/command/commands.c index e1710ae1..4bc1f880 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1787,6 +1787,18 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args) cons_show("Roster contact char set to %c.", args[2][0]); rosterwin_roster(); } + } else if (g_strcmp0(args[1], "resource") == 0) { + if (!args[2]) { + cons_bad_cmd_usage(command); + } else if (g_strcmp0(args[2], "none") == 0) { + prefs_clear_roster_resource_char(); + cons_show("Roster resource char removed."); + rosterwin_roster(); + } else { + prefs_set_roster_resource_char(args[2][0]); + cons_show("Roster resource char set to %c.", args[2][0]); + rosterwin_roster(); + } } else { cons_bad_cmd_usage(command); } |