mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added /room config command
This commit is contained in:
parent
57effcd504
commit
52a9ab6909
@ -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;
|
||||
@ -2038,6 +2061,24 @@ _theme_autocomplete(char *input, int *size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1786,6 +1786,20 @@ cmd_decline(gchar **args, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user