1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added account status autocomplete

This commit is contained in:
James Booth 2015-08-03 00:33:16 +01:00
parent 7151792b8c
commit 5619ba7058

View File

@ -1628,6 +1628,7 @@ static Autocomplete account_ac;
static Autocomplete account_set_ac; static Autocomplete account_set_ac;
static Autocomplete account_clear_ac; static Autocomplete account_clear_ac;
static Autocomplete account_default_ac; static Autocomplete account_default_ac;
static Autocomplete account_status_ac;
static Autocomplete disco_ac; static Autocomplete disco_ac;
static Autocomplete close_ac; static Autocomplete close_ac;
static Autocomplete wins_ac; static Autocomplete wins_ac;
@ -1837,6 +1838,14 @@ cmd_init(void)
autocomplete_add(account_default_ac, "set"); autocomplete_add(account_default_ac, "set");
autocomplete_add(account_default_ac, "off"); 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(); close_ac = autocomplete_new();
autocomplete_add(close_ac, "read"); autocomplete_add(close_ac, "read");
autocomplete_add(close_ac, "all"); autocomplete_add(close_ac, "all");
@ -2075,6 +2084,7 @@ cmd_uninit(void)
autocomplete_free(account_set_ac); autocomplete_free(account_set_ac);
autocomplete_free(account_clear_ac); autocomplete_free(account_clear_ac);
autocomplete_free(account_default_ac); autocomplete_free(account_default_ac);
autocomplete_free(account_status_ac);
autocomplete_free(disco_ac); autocomplete_free(disco_ac);
autocomplete_free(close_ac); autocomplete_free(close_ac);
autocomplete_free(wins_ac); autocomplete_free(wins_ac);
@ -2250,6 +2260,7 @@ cmd_reset_autocomplete(ProfWin *window)
autocomplete_reset(account_set_ac); autocomplete_reset(account_set_ac);
autocomplete_reset(account_clear_ac); autocomplete_reset(account_clear_ac);
autocomplete_reset(account_default_ac); autocomplete_reset(account_default_ac);
autocomplete_reset(account_status_ac);
autocomplete_reset(disco_ac); autocomplete_reset(disco_ac);
autocomplete_reset(close_ac); autocomplete_reset(close_ac);
autocomplete_reset(wins_ac); autocomplete_reset(wins_ac);
@ -3556,6 +3567,15 @@ _account_autocomplete(ProfWin *window, const char * const input)
g_strfreev(args); g_strfreev(args);
return found; 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 { } else {
found = autocomplete_param_with_ac(input, beginning->str, account_set_ac, TRUE); found = autocomplete_param_with_ac(input, beginning->str, account_set_ac, TRUE);
g_string_free(beginning, TRUE); g_string_free(beginning, TRUE);