diff options
author | James Booth <boothj5@gmail.com> | 2015-11-19 23:21:51 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-11-19 23:21:51 +0000 |
commit | 316b6a7b8bf2aab233bc777d0eb224e6af814f7b (patch) | |
tree | 2febb8f2f98a597c268b076d2601550d21dd6365 /src/command | |
parent | 78a8487892a294b4690d20e04f0081d5d6c71823 (diff) | |
download | profani-tty-316b6a7b8bf2aab233bc777d0eb224e6af814f7b.tar.gz |
Added /roster char header
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 24 | ||||
-rw-r--r-- | src/command/commands.c | 19 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index 241865d5..587fd241 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -278,6 +278,7 @@ static struct cmd_t command_defs[] = "/roster hide [offline|resource|presence|status|empty|count|priority]", "/roster by group|presence|none", "/roster order name|presence", + "/roster char header <char>|none", "/roster size <percent>", "/roster add <jid> [<nick>]", "/roster remove <jid>", @@ -310,6 +311,8 @@ static struct cmd_t command_defs[] = { "by none", "No grouping in the roster panel." }, { "order name", "Order roster items by name only." }, { "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." }, { "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." }, @@ -1776,6 +1779,8 @@ static Autocomplete disco_ac; static Autocomplete close_ac; static Autocomplete wins_ac; static Autocomplete roster_ac; +static Autocomplete roster_char_ac; +static Autocomplete roster_char_none_ac; static Autocomplete roster_option_ac; static Autocomplete roster_by_ac; static Autocomplete roster_order_ac; @@ -2024,6 +2029,13 @@ cmd_init(void) autocomplete_add(roster_ac, "by"); autocomplete_add(roster_ac, "order"); autocomplete_add(roster_ac, "size"); + autocomplete_add(roster_ac, "char"); + + roster_char_ac = autocomplete_new(); + autocomplete_add(roster_char_ac, "header"); + + roster_char_none_ac = autocomplete_new(); + autocomplete_add(roster_char_none_ac, "none"); roster_option_ac = autocomplete_new(); autocomplete_add(roster_option_ac, "offline"); @@ -2295,6 +2307,8 @@ cmd_uninit(void) autocomplete_free(close_ac); autocomplete_free(wins_ac); autocomplete_free(roster_ac); + autocomplete_free(roster_char_ac); + autocomplete_free(roster_char_none_ac); autocomplete_free(roster_option_ac); autocomplete_free(roster_by_ac); autocomplete_free(roster_order_ac); @@ -2482,6 +2496,8 @@ cmd_reset_autocomplete(ProfWin *window) autocomplete_reset(close_ac); autocomplete_reset(wins_ac); autocomplete_reset(roster_ac); + autocomplete_reset(roster_char_ac); + autocomplete_reset(roster_char_none_ac); autocomplete_reset(roster_option_ac); autocomplete_reset(roster_by_ac); autocomplete_reset(roster_order_ac); @@ -2870,6 +2886,10 @@ static char* _roster_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; + result = autocomplete_param_with_ac(input, "/roster char header", roster_char_none_ac, TRUE); + if (result) { + return result; + } result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete); if (result) { return result; @@ -2902,6 +2922,10 @@ _roster_autocomplete(ProfWin *window, const char *const input) if (result) { return result; } + result = autocomplete_param_with_ac(input, "/roster char", roster_char_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 92ca5daf..7f67e19d 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1750,6 +1750,25 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args) return TRUE; } + // set header character + } else if (g_strcmp0(args[0], "char") == 0) { + if (g_strcmp0(args[1], "header") == 0) { + if (!args[2]) { + cons_bad_cmd_usage(command); + } else if (g_strcmp0(args[2], "none") == 0) { + prefs_clear_roster_header_char(); + cons_show("Roster header char removed."); + rosterwin_roster(); + } else { + prefs_set_roster_header_char(args[2][0]); + cons_show("Roster header char set to %c.", args[2][0]); + rosterwin_roster(); + } + } else { + cons_bad_cmd_usage(command); + } + return TRUE; + // show/hide roster } else if (g_strcmp0(args[0], "show") == 0) { if (args[1] == NULL) { |