diff options
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 41 | ||||
-rw-r--r-- | src/command/commands.c | 14 | ||||
-rw-r--r-- | src/command/commands.h | 1 |
3 files changed, 56 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; diff --git a/src/command/commands.c b/src/command/commands.c index 1760d18c..53e21c2f 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1787,6 +1787,20 @@ cmd_decline(gchar **args, struct cmd_help_t help) } gboolean +cmd_room(gchar **args, struct cmd_help_t help) +{ + jabber_conn_status_t conn_status = jabber_get_connection_status(); + + if (conn_status != JABBER_CONNECTED) { + cons_show("You are not currently connected."); + return TRUE; + } + + cons_show("You said %s.", args[1]); + return TRUE; +} + +gboolean cmd_rooms(gchar **args, struct cmd_help_t help) { jabber_conn_status_t conn_status = jabber_get_connection_status(); diff --git a/src/command/commands.h b/src/command/commands.h index b685fed3..3f7c45bb 100644 --- a/src/command/commands.h +++ b/src/command/commands.h @@ -104,6 +104,7 @@ gboolean cmd_prefs(gchar **args, struct cmd_help_t help); gboolean cmd_priority(gchar **args, struct cmd_help_t help); gboolean cmd_quit(gchar **args, struct cmd_help_t help); gboolean cmd_reconnect(gchar **args, struct cmd_help_t help); +gboolean cmd_room(gchar **args, struct cmd_help_t help); gboolean cmd_rooms(gchar **args, struct cmd_help_t help); gboolean cmd_bookmark(gchar **args, struct cmd_help_t help); gboolean cmd_roster(gchar **args, struct cmd_help_t help); |