diff options
author | James Booth <boothj5@gmail.com> | 2014-10-04 23:58:54 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-10-04 23:58:54 +0100 |
commit | fd5326b40b0f4d7389d2d8d76106cbb52ac26d9d (patch) | |
tree | ace122d89e590fe469a06117b145f002457badee /src/command/command.c | |
parent | 0b78a9a57e3d1a39cd2826c073eb69d6954ad32b (diff) | |
download | profani-tty-fd5326b40b0f4d7389d2d8d76106cbb52ac26d9d.tar.gz |
Added autocompleters for /room subcommands
Diffstat (limited to 'src/command/command.c')
-rw-r--r-- | src/command/command.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index 868facea..0184eb97 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -973,6 +973,9 @@ static Autocomplete alias_ac; static Autocomplete aliases_ac; static Autocomplete join_property_ac; static Autocomplete room_ac; +static Autocomplete room_affiliation_ac; +static Autocomplete room_role_ac; +static Autocomplete room_cmd_ac; static Autocomplete form_ac; /* @@ -1249,6 +1252,23 @@ cmd_init(void) autocomplete_add(room_ac, "role"); autocomplete_add(room_ac, "affiliation"); + room_affiliation_ac = autocomplete_new(); + autocomplete_add(room_affiliation_ac, "owner"); + autocomplete_add(room_affiliation_ac, "admin"); + autocomplete_add(room_affiliation_ac, "member"); + autocomplete_add(room_affiliation_ac, "outcast"); + autocomplete_add(room_affiliation_ac, "none"); + + room_role_ac = autocomplete_new(); + autocomplete_add(room_role_ac, "moderator"); + autocomplete_add(room_role_ac, "participant"); + autocomplete_add(room_role_ac, "visitor"); + autocomplete_add(room_role_ac, "none"); + + room_cmd_ac = autocomplete_new(); + autocomplete_add(room_cmd_ac, "list"); + autocomplete_add(room_cmd_ac, "set"); + form_ac = autocomplete_new(); autocomplete_add(form_ac, "submit"); autocomplete_add(form_ac, "cancel"); @@ -1301,6 +1321,9 @@ cmd_uninit(void) autocomplete_free(aliases_ac); autocomplete_free(join_property_ac); autocomplete_free(room_ac); + autocomplete_free(room_affiliation_ac); + autocomplete_free(room_role_ac); + autocomplete_free(room_cmd_ac); autocomplete_free(form_ac); } @@ -1427,6 +1450,9 @@ cmd_reset_autocomplete() autocomplete_reset(aliases_ac); autocomplete_reset(join_property_ac); autocomplete_reset(room_ac); + autocomplete_reset(room_affiliation_ac); + autocomplete_reset(room_role_ac); + autocomplete_reset(room_cmd_ac); autocomplete_reset(form_ac); if (ui_current_win_type() == WIN_MUC_CONFIG) { @@ -2243,6 +2269,36 @@ _room_autocomplete(char *input, int *size) { char *result = NULL; + result = autocomplete_param_with_ac(input, size, "/room affiliation set", room_affiliation_ac, TRUE); + if (result != NULL) { + return result; + } + + result = autocomplete_param_with_ac(input, size, "/room affiliation list", room_affiliation_ac, TRUE); + if (result != NULL) { + return result; + } + + result = autocomplete_param_with_ac(input, size, "/room role set", room_role_ac, TRUE); + if (result != NULL) { + return result; + } + + result = autocomplete_param_with_ac(input, size, "/room role list", room_role_ac, TRUE); + if (result != NULL) { + return result; + } + + result = autocomplete_param_with_ac(input, size, "/room affiliation", room_cmd_ac, TRUE); + if (result != NULL) { + return result; + } + + result = autocomplete_param_with_ac(input, size, "/room role", room_cmd_ac, TRUE); + if (result != NULL) { + return result; + } + result = autocomplete_param_with_ac(input, size, "/room", room_ac, TRUE); if (result != NULL) { return result; |