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

Added /console chat autocompletion

This commit is contained in:
James Booth 2016-02-03 22:47:06 +00:00
parent 30116dd922
commit 003cdcf3fb

View File

@ -1049,14 +1049,18 @@ static struct cmd_t command_defs[] =
CMD_TAG_UI, CMD_TAG_UI,
CMD_TAG_GROUPCHAT) CMD_TAG_GROUPCHAT)
CMD_SYN( CMD_SYN(
"/console chat all|first|none",
"/console muc all|first|none") "/console muc all|first|none")
CMD_DESC( CMD_DESC(
"Configure what is displayed in the console window when new chat room messages are received. " "Configure what is displayed in the console window when messages are received. "
"The default is set to 'all'.") "The default is set to 'all' for all types of messages.")
CMD_ARGS( CMD_ARGS(
{ "chat all", "Indicate all new chat messages in the console." },
{ "chat first", "Indicate only the first new message per chat in the console." },
{ "chat none", "Do not show any new chat messages in the console window." },
{ "muc all", "Indicate all new chat room messages in the console." }, { "muc all", "Indicate all new chat room messages in the console." },
{ "muc first", "Indicate only the first new message in each room in the console." }, { "muc first", "Indicate only the first new message in each room in the console." },
{ "muc none", "Do not show any new messages in the console window." }) { "muc none", "Do not show any new chat room messages in the console window." })
CMD_NOEXAMPLES CMD_NOEXAMPLES
}, },
@ -1990,7 +1994,7 @@ static Autocomplete tls_certpath_ac;
static Autocomplete script_ac; static Autocomplete script_ac;
static Autocomplete script_show_ac; static Autocomplete script_show_ac;
static Autocomplete console_ac; static Autocomplete console_ac;
static Autocomplete console_muc_ac; static Autocomplete console_msg_ac;
static Autocomplete autoping_ac; static Autocomplete autoping_ac;
/* /*
@ -2520,12 +2524,13 @@ cmd_init(void)
script_show_ac = NULL; script_show_ac = NULL;
console_ac = autocomplete_new(); console_ac = autocomplete_new();
autocomplete_add(console_ac, "chat");
autocomplete_add(console_ac, "muc"); autocomplete_add(console_ac, "muc");
console_muc_ac = autocomplete_new(); console_msg_ac = autocomplete_new();
autocomplete_add(console_muc_ac, "all"); autocomplete_add(console_msg_ac, "all");
autocomplete_add(console_muc_ac, "first"); autocomplete_add(console_msg_ac, "first");
autocomplete_add(console_muc_ac, "none"); autocomplete_add(console_msg_ac, "none");
autoping_ac = autocomplete_new(); autoping_ac = autocomplete_new();
autocomplete_add(autoping_ac, "set"); autocomplete_add(autoping_ac, "set");
@ -2614,7 +2619,7 @@ cmd_uninit(void)
autocomplete_free(script_ac); autocomplete_free(script_ac);
autocomplete_free(script_show_ac); autocomplete_free(script_show_ac);
autocomplete_free(console_ac); autocomplete_free(console_ac);
autocomplete_free(console_muc_ac); autocomplete_free(console_msg_ac);
autocomplete_free(autoping_ac); autocomplete_free(autoping_ac);
} }
@ -2828,7 +2833,7 @@ cmd_reset_autocomplete(ProfWin *window)
autocomplete_reset(tls_ac); autocomplete_reset(tls_ac);
autocomplete_reset(tls_certpath_ac); autocomplete_reset(tls_certpath_ac);
autocomplete_reset(console_ac); autocomplete_reset(console_ac);
autocomplete_reset(console_muc_ac); autocomplete_reset(console_msg_ac);
autocomplete_reset(autoping_ac); autocomplete_reset(autoping_ac);
autocomplete_reset(script_ac); autocomplete_reset(script_ac);
if (script_show_ac) { if (script_show_ac) {
@ -4405,7 +4410,11 @@ _console_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
result = autocomplete_param_with_ac(input, "/console muc", console_muc_ac, TRUE); result = autocomplete_param_with_ac(input, "/console chat", console_msg_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/console muc", console_msg_ac, TRUE);
if (result) { if (result) {
return result; return result;
} }