diff options
author | James Booth <boothj5@gmail.com> | 2015-11-22 16:37:05 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-11-22 16:37:05 +0000 |
commit | 0f22179eef2c5b88b3fa30c76a09308987376d0c (patch) | |
tree | c34260af36dda7a6cc5ad6f2bd445bf890199b53 /src/command | |
parent | 0a0226186a95209f5c83be335abae7ea52e43bcd (diff) | |
download | profani-tty-0f22179eef2c5b88b3fa30c76a09308987376d0c.tar.gz |
Added /roster resource join
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 17 | ||||
-rw-r--r-- | src/command/commands.c | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index c80ce2b4..367d3c29 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -284,6 +284,7 @@ static struct cmd_t command_defs[] = "/roster indent contact <indent>", "/roster indent resource <indent>", "/roster indent presence <indent>", + "/roster resource join on|off", "/roster size <percent>", "/roster wrap on|off", "/roster add <jid> [<nick>]", @@ -326,6 +327,7 @@ static struct cmd_t command_defs[] = { "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." }, + { "resource join on|off", "Join resource with previous line when only one available resource." }, { "size <precent>", "Percentage of the screen taken up by the roster (1-99)." }, { "wrap on|off", "Enabled or disanle line wrapping in roster panel." }, { "add <jid> [<nick>]", "Add a new item to the roster." }, @@ -1793,6 +1795,7 @@ static Autocomplete disco_ac; static Autocomplete close_ac; static Autocomplete wins_ac; static Autocomplete roster_ac; +static Autocomplete roster_resource_ac; static Autocomplete roster_char_ac; static Autocomplete roster_char_none_ac; static Autocomplete roster_indent_ac; @@ -2047,6 +2050,10 @@ cmd_init(void) autocomplete_add(roster_ac, "char"); autocomplete_add(roster_ac, "indent"); autocomplete_add(roster_ac, "wrap"); + autocomplete_add(roster_ac, "resource"); + + roster_resource_ac = autocomplete_new(); + autocomplete_add(roster_resource_ac, "join"); roster_char_ac = autocomplete_new(); autocomplete_add(roster_char_ac, "header"); @@ -2331,6 +2338,7 @@ cmd_uninit(void) autocomplete_free(close_ac); autocomplete_free(wins_ac); autocomplete_free(roster_ac); + autocomplete_free(roster_resource_ac); autocomplete_free(roster_char_ac); autocomplete_free(roster_char_none_ac); autocomplete_free(roster_indent_ac); @@ -2521,6 +2529,7 @@ cmd_reset_autocomplete(ProfWin *window) autocomplete_reset(close_ac); autocomplete_reset(wins_ac); autocomplete_reset(roster_ac); + autocomplete_reset(roster_resource_ac); autocomplete_reset(roster_char_ac); autocomplete_reset(roster_char_none_ac); autocomplete_reset(roster_indent_ac); @@ -2912,6 +2921,10 @@ static char* _roster_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; + result = autocomplete_param_with_func(input, "/roster resource join", prefs_autocomplete_boolean_choice); + if (result) { + return result; + } result = autocomplete_param_with_ac(input, "/roster char header", roster_char_none_ac, TRUE); if (result) { return result; @@ -2968,6 +2981,10 @@ _roster_autocomplete(ProfWin *window, const char *const input) if (result) { return result; } + result = autocomplete_param_with_ac(input, "/roster resource", roster_resource_ac, TRUE); + if (result) { + return result; + } result = autocomplete_param_with_ac(input, "/roster", roster_ac, TRUE); if (result) { return result; diff --git a/src/command/commands.c b/src/command/commands.c index 4bc1f880..d352fd5a 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1761,6 +1761,17 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args) return res; } + // roster join with previous line + } else if (g_strcmp0(args[0], "resource") == 0) { + if (g_strcmp0(args[1], "join") == 0) { + int res = _cmd_set_boolean_preference(args[2], command, "Roster join", PREF_ROSTER_RESOURCE_JOIN); + rosterwin_roster(); + return res; + } else { + cons_bad_cmd_usage(command); + return TRUE; + } + // set header character } else if (g_strcmp0(args[0], "char") == 0) { if (g_strcmp0(args[1], "header") == 0) { |