diff options
Diffstat (limited to 'src/command/command.c')
-rw-r--r-- | src/command/command.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index f6918e99..fcb37078 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -86,6 +86,7 @@ static char * _statuses_autocomplete(char *input, int *size); static char * _alias_autocomplete(char *input, int *size); static char * _join_autocomplete(char *input, int *size); static char * _log_autocomplete(char *input, int *size); +static char * _room_autocomplete(char *input, int *size); GHashTable *commands = NULL; @@ -303,6 +304,14 @@ static struct cmd_t command_defs[] = "Decline invitation to a chat room, the room will no longer be in the list of outstanding invites.", NULL } } }, + { "/room", + cmd_room, parse_args, 2, 2, NULL, + { "/room config accept|cancel", "Room configuration.", + { "/room config accept|cncel", + "-------------------------", + "Accept or cancel room creation.", + NULL } } }, + { "/rooms", cmd_rooms, parse_args, 0, 1, NULL, { "/rooms [conference-service]", "List chat rooms.", @@ -934,6 +943,8 @@ static Autocomplete statuses_setting_ac; static Autocomplete alias_ac; static Autocomplete aliases_ac; static Autocomplete join_property_ac; +static Autocomplete room_ac; +static Autocomplete room_config_ac; /* * Initialise command autocompleter and history @@ -1185,6 +1196,13 @@ cmd_init(void) autocomplete_add(alias_ac, "remove"); autocomplete_add(alias_ac, "list"); + room_ac = autocomplete_new(); + autocomplete_add(room_ac, "config"); + + room_config_ac = autocomplete_new(); + autocomplete_add(room_config_ac, "accept"); + autocomplete_add(room_config_ac, "cancel"); + cmd_history_init(); } @@ -1228,6 +1246,8 @@ cmd_uninit(void) autocomplete_free(alias_ac); autocomplete_free(aliases_ac); autocomplete_free(join_property_ac); + autocomplete_free(room_ac); + autocomplete_free(room_config_ac); } gboolean @@ -1351,6 +1371,8 @@ cmd_reset_autocomplete() autocomplete_reset(alias_ac); autocomplete_reset(aliases_ac); autocomplete_reset(join_property_ac); + autocomplete_reset(room_ac); + autocomplete_reset(room_config_ac); bookmark_autocomplete_reset(); } @@ -1629,6 +1651,7 @@ _cmd_complete_parameters(char *input, int *size) g_hash_table_insert(ac_funcs, "/statuses", _statuses_autocomplete); g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete); g_hash_table_insert(ac_funcs, "/join", _join_autocomplete); + g_hash_table_insert(ac_funcs, "/room", _room_autocomplete); char parsed[*size+1]; i = 0; @@ -2039,6 +2062,24 @@ _theme_autocomplete(char *input, int *size) } static char * +_room_autocomplete(char *input, int *size) +{ + char *result = NULL; + + result = autocomplete_param_with_ac(input, size, "/room config", room_config_ac, TRUE); + if (result != NULL) { + return result; + } + + result = autocomplete_param_with_ac(input, size, "/room", room_ac, TRUE); + if (result != NULL) { + return result; + } + + return NULL; +} + +static char * _statuses_autocomplete(char *input, int *size) { char *result = NULL; |