From 5619ba70588989a4933aa3c5f2e13ff604c11a2b Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 3 Aug 2015 00:33:16 +0100 Subject: [PATCH] Added account status autocomplete --- src/command/command.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/command/command.c b/src/command/command.c index 182dcc70..9ff66c75 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1628,6 +1628,7 @@ static Autocomplete account_ac; static Autocomplete account_set_ac; static Autocomplete account_clear_ac; static Autocomplete account_default_ac; +static Autocomplete account_status_ac; static Autocomplete disco_ac; static Autocomplete close_ac; static Autocomplete wins_ac; @@ -1837,6 +1838,14 @@ cmd_init(void) autocomplete_add(account_default_ac, "set"); autocomplete_add(account_default_ac, "off"); + account_status_ac = autocomplete_new(); + autocomplete_add(account_status_ac, "online"); + autocomplete_add(account_status_ac, "chat"); + autocomplete_add(account_status_ac, "away"); + autocomplete_add(account_status_ac, "xa"); + autocomplete_add(account_status_ac, "dnd"); + autocomplete_add(account_status_ac, "last"); + close_ac = autocomplete_new(); autocomplete_add(close_ac, "read"); autocomplete_add(close_ac, "all"); @@ -2075,6 +2084,7 @@ cmd_uninit(void) autocomplete_free(account_set_ac); autocomplete_free(account_clear_ac); autocomplete_free(account_default_ac); + autocomplete_free(account_status_ac); autocomplete_free(disco_ac); autocomplete_free(close_ac); autocomplete_free(wins_ac); @@ -2250,6 +2260,7 @@ cmd_reset_autocomplete(ProfWin *window) autocomplete_reset(account_set_ac); autocomplete_reset(account_clear_ac); autocomplete_reset(account_default_ac); + autocomplete_reset(account_status_ac); autocomplete_reset(disco_ac); autocomplete_reset(close_ac); autocomplete_reset(wins_ac); @@ -3556,6 +3567,15 @@ _account_autocomplete(ProfWin *window, const char * const input) g_strfreev(args); return found; } + } else if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "status")) == 0) { + g_string_append(beginning, " "); + g_string_append(beginning, args[2]); + found = autocomplete_param_with_ac(input, beginning->str, account_status_ac, TRUE); + g_string_free(beginning, TRUE); + if (found) { + g_strfreev(args); + return found; + } } else { found = autocomplete_param_with_ac(input, beginning->str, account_set_ac, TRUE); g_string_free(beginning, TRUE);