about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-11-12 12:39:24 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-11-12 12:39:24 +0100
commit9bc4dc382773896c4d5c4ab74e60a02a92021d5b (patch)
treef0a85010176f9f9516b4a042b55015a51f3faead /src/command/cmd_funcs.c
parent0945a309259bc658d43b8cf48fe5efa767082cd7 (diff)
downloadprofani-tty-9bc4dc382773896c4d5c4ab74e60a02a92021d5b.tar.gz
Merge /chlog and /grlog commands into /logging
Instead of `/chlog on` we now have `/logging chat on`.
Instead of `/grlog on` we now have `/logging group on`.

Fix https://github.com/profanity-im/profanity/issues/1224
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 4a78d415..f7d71b13 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -6692,31 +6692,30 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
-cmd_chlog(ProfWin *window, const char *const command, gchar **args)
+cmd_logging(ProfWin *window, const char *const command, gchar **args)
 {
     if (args[0] == NULL) {
-        return FALSE;
+        cons_logging_setting();
+        return TRUE;
     }
 
-    _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
+    if (strcmp(args[0], "chat") == 0) {
+        _cmd_set_boolean_preference(args[1], command, "Chat logging", PREF_CHLOG);
 
-    // if set to off, disable history
-    if (strcmp(args[0], "off") == 0) {
-        prefs_set_boolean(PREF_HISTORY, FALSE);
+        // if set to off, disable history
+        if (strcmp(args[1], "off") == 0) {
+            prefs_set_boolean(PREF_HISTORY, FALSE);
+        }
+    } else if (strcmp(args[0], "group") == 0) {
+        _cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG);
+    } else {
+        cons_bad_cmd_usage(command);
     }
 
     return TRUE;
 }
 
 gboolean
-cmd_grlog(ProfWin *window, const char *const command, gchar **args)
-{
-    _cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
-
-    return TRUE;
-}
-
-gboolean
 cmd_history(ProfWin *window, const char *const command, gchar **args)
 {
     if (args[0] == NULL) {