diff options
author | James Booth <boothj5@gmail.com> | 2014-11-11 00:30:29 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-11-11 00:30:29 +0000 |
commit | a45cb4bb3c10bf9ed9f2c0df1ec706efd79052f4 (patch) | |
tree | 349796aaeecef8395e8876d9325615f692e93e77 /src/command | |
parent | eace543da5620ca4c1d94d74ddd5342be4c66f47 (diff) | |
download | profani-tty-a45cb4bb3c10bf9ed9f2c0df1ec706efd79052f4.tar.gz |
Added /roster by commands, wip
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 22 | ||||
-rw-r--r-- | src/command/commands.c | 21 |
2 files changed, 40 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c index 953128a8..83f9d660 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -169,9 +169,9 @@ static struct cmd_t command_defs[] = { "/roster", cmd_roster, parse_args_with_freetext, 0, 3, NULL, - { "/roster [show|hide|add|remove|nick|clearnick] [offline|resource] [jid] [nickname]", "Manage your roster.", - { "/roster [show|hide|add|remove|nick|clearnick] [offline|resource] [jid] [nickname]", - "---------------------------------------------------------------------------------", + { "/roster [show|hide|by|add|remove|nick|clearnick] [offline|resource] [group|presence|none] [jid] [nickname]", "Manage your roster.", + { "/roster [show|hide|by|add|remove|nick|clearnick] [offline|resource] [group|presence|none] [jid] [nickname]", + "----------------------------------------------------------------------------------------------------------", "View, add to, and remove from your roster.", "Passing no arguments lists all contacts in your roster.", "show - Show the roster panel in the console window.", @@ -180,6 +180,9 @@ static struct cmd_t command_defs[] = "hide offline - Hide offline contacts in the roster panel.", "show resource - Show contact's connected resources in the roster panel.", "hide resource - Hide contact's connected resources in the roster panel.", + "by group - Group contacts in the roster panel by roster group.", + "by presence - Group contacts in the roster panel by presence.", + "by none - No grouping in the roster panel.", "add - Add a new item, jid is required, nickname is optional.", "remove - Removes a contact, jid is required.", "nick - Changes a contacts nickname, both jid and nickname are required,", @@ -1044,6 +1047,7 @@ static Autocomplete close_ac; static Autocomplete wins_ac; static Autocomplete roster_ac; static Autocomplete roster_option_ac; +static Autocomplete roster_by_ac; static Autocomplete group_ac; static Autocomplete bookmark_ac; static Autocomplete bookmark_property_ac; @@ -1239,11 +1243,17 @@ cmd_init(void) autocomplete_add(roster_ac, "remove"); autocomplete_add(roster_ac, "show"); autocomplete_add(roster_ac, "hide"); + autocomplete_add(roster_ac, "by"); roster_option_ac = autocomplete_new(); autocomplete_add(roster_option_ac, "offline"); autocomplete_add(roster_option_ac, "resource"); + roster_by_ac = autocomplete_new(); + autocomplete_add(roster_by_ac, "group"); + autocomplete_add(roster_by_ac, "presence"); + autocomplete_add(roster_by_ac, "none"); + group_ac = autocomplete_new(); autocomplete_add(group_ac, "show"); autocomplete_add(group_ac, "add"); @@ -1414,6 +1424,7 @@ cmd_uninit(void) autocomplete_free(wins_ac); autocomplete_free(roster_ac); autocomplete_free(roster_option_ac); + autocomplete_free(roster_by_ac); autocomplete_free(group_ac); autocomplete_free(bookmark_ac); autocomplete_free(bookmark_property_ac); @@ -1583,6 +1594,7 @@ cmd_reset_autocomplete() autocomplete_reset(wins_ac); autocomplete_reset(roster_ac); autocomplete_reset(roster_option_ac); + autocomplete_reset(roster_by_ac); autocomplete_reset(group_ac); autocomplete_reset(bookmark_ac); autocomplete_reset(bookmark_property_ac); @@ -2019,6 +2031,10 @@ _roster_autocomplete(char *input, int *size) if (result != NULL) { return result; } + result = autocomplete_param_with_ac(input, size, "/roster by", roster_by_ac, TRUE); + if (result != NULL) { + return result; + } result = autocomplete_param_with_ac(input, size, "/roster", roster_ac, TRUE); if (result != NULL) { return result; diff --git a/src/command/commands.c b/src/command/commands.c index 30e317bd..cfc10024 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1371,6 +1371,27 @@ cmd_roster(gchar **args, struct cmd_help_t help) cons_show("Usage: %s", help.usage); return TRUE; } + // roster grouping + } else if (g_strcmp0(args[0], "by") == 0) { + if (g_strcmp0(args[1], "group") == 0) { + cons_show("Grouping roster by roster group"); + prefs_set_string(PREF_ROSTER_BY, "group"); + ui_roster(); + return TRUE; + } else if (g_strcmp0(args[1], "presence") == 0) { + cons_show("Grouping roster by presence"); + prefs_set_string(PREF_ROSTER_BY, "presence"); + ui_roster(); + return TRUE; + } else if (g_strcmp0(args[1], "none") == 0) { + cons_show("Roster grouping disabled"); + prefs_set_string(PREF_ROSTER_BY, "none"); + ui_roster(); + return TRUE; + } else { + cons_show("Usage: %s", help.usage); + return TRUE; + } // add contact } else if (strcmp(args[0], "add") == 0) { char *jid = args[1]; |