Implemented /console private setting

This commit is contained in:
James Booth
2016-02-03 23:39:20 +00:00
parent 19a3066e28
commit bab75cae15
13 changed files with 169 additions and 130 deletions

View File

@@ -1047,20 +1047,25 @@ static struct cmd_t command_defs[] =
cmd_console, parse_args, 2, 2, &cons_console_setting,
CMD_TAGS(
CMD_TAG_UI,
CMD_TAG_CHAT,
CMD_TAG_GROUPCHAT)
CMD_SYN(
"/console chat all|first|none",
"/console muc all|first|none")
"/console muc all|first|none",
"/console private all|first|none")
CMD_DESC(
"Configure what is displayed in the console window when messages are received. "
"The default is set to 'all' for all types of messages.")
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 first", "Indicate only the first new message in each room in the console." },
{ "muc none", "Do not show any new chat room messages in the console window." })
{ "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 first", "Indicate only the first new message in each room in the console." },
{ "muc none", "Do not show any new chat room messages in the console window." },
{ "private all", "Indicate all new private room messages in the console." },
{ "private first", "Indicate only the first private room message in the console." },
{ "private none", "Do not show any new private room messages in the console window." })
CMD_NOEXAMPLES
},
@@ -2526,6 +2531,7 @@ cmd_init(void)
console_ac = autocomplete_new();
autocomplete_add(console_ac, "chat");
autocomplete_add(console_ac, "muc");
autocomplete_add(console_ac, "private");
console_msg_ac = autocomplete_new();
autocomplete_add(console_msg_ac, "all");
@@ -4418,6 +4424,10 @@ _console_autocomplete(ProfWin *window, const char *const input)
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/console private", console_msg_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/console", console_ac, TRUE);
if (result) {

View File

@@ -4409,7 +4409,7 @@ cmd_beep(ProfWin *window, const char *const command, gchar **args)
gboolean
cmd_console(ProfWin *window, const char *const command, gchar **args)
{
if ((g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "muc") != 0)) {
if ((g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "muc") != 0) && (g_strcmp0(args[0], "private") != 0)) {
cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4432,6 +4432,12 @@ cmd_console(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
if (g_strcmp0(args[0], "private") == 0) {
prefs_set_string(PREF_CONSOLE_PRIVATE, setting);
cons_show("Console private room messages set: %s", setting);
return TRUE;
}
return TRUE;
}