about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-02-03 23:39:20 +0000
committerJames Booth <boothj5@gmail.com>2016-02-03 23:39:20 +0000
commitbab75cae155b9a6b55afe404f674b7edc3eb8fa1 (patch)
tree735b07e1922efb6254312cd7e56b82467185d1d5 /src/command
parent19a3066e28166fddfdcad7177034d8e111aa5712 (diff)
downloadprofani-tty-bab75cae155b9a6b55afe404f674b7edc3eb8fa1.tar.gz
Implemented /console private setting
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c24
-rw-r--r--src/command/commands.c8
2 files changed, 24 insertions, 8 deletions
diff --git a/src/command/command.c b/src/command/command.c
index ce904ca9..d2d7f4ab 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -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) {
diff --git a/src/command/commands.c b/src/command/commands.c
index 6a364916..6570f13d 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -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;
 }