From 95ab7ee062b9fbeea73b90f69c6fef3325f880c9 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Fri, 10 Jul 2020 15:16:34 +0200 Subject: Setting: only write in console upon muc mention `/console muc mention` additionally to `first|none|all`. Fix https://github.com/profanity-im/profanity/issues/1371 --- src/command/cmd_ac.c | 1 + src/command/cmd_defs.c | 3 ++- src/command/cmd_funcs.c | 12 ++++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/command') diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 25e48e88..01211b16 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -913,6 +913,7 @@ cmd_ac_init(void) console_msg_ac = autocomplete_new(); autocomplete_add(console_msg_ac, "all"); autocomplete_add(console_msg_ac, "first"); + autocomplete_add(console_msg_ac, "mention"); autocomplete_add(console_msg_ac, "none"); autoping_ac = autocomplete_new(); diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 04adb92d..787de7cd 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -1141,7 +1141,7 @@ static struct cmd_t command_defs[] = { CMD_TAG_GROUPCHAT) CMD_SYN( "/console chat all|first|none", - "/console muc all|first|none", + "/console muc all|first|mention|none", "/console private all|first|none") CMD_DESC( "Configure what is displayed in the console window when messages are received. " @@ -1152,6 +1152,7 @@ static struct cmd_t command_defs[] = { { "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 mention", "Indicate only messages in which you have beeen mentioned 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." }, diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index b0b00769..5c01cedc 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -5153,15 +5153,19 @@ 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) && (g_strcmp0(args[0], "private") != 0)) { + gboolean isMuc = (g_strcmp0(args[0], "muc") == 0) ; + + if ((g_strcmp0(args[0], "chat") != 0) && !isMuc && (g_strcmp0(args[0], "private") != 0)) { cons_bad_cmd_usage(command); return TRUE; } - char* setting = args[1]; + gchar* setting = args[1]; if ((g_strcmp0(setting, "all") != 0) && (g_strcmp0(setting, "first") != 0) && (g_strcmp0(setting, "none") != 0)) { - cons_bad_cmd_usage(command); - return TRUE; + if ( !(isMuc && (g_strcmp0(setting, "mention") == 0))) { + cons_bad_cmd_usage(command); + return TRUE; + } } if (g_strcmp0(args[0], "chat") == 0) { -- cgit 1.4.1-2-gfad0