about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c2
-rw-r--r--src/command/cmd_defs.c17
-rw-r--r--src/command/cmd_funcs.c12
-rw-r--r--src/command/cmd_funcs.h1
4 files changed, 31 insertions, 1 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 12331bfb..0266d8f5 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -1567,7 +1567,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
 
     // autocomplete boolean settings
     gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
-        "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity", "/os"};
+        "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity", "/os", "/slashguard"};
 
     for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
         result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous, NULL);
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 8b45f646..3845b901 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2418,6 +2418,23 @@ static struct cmd_t command_defs[] =
             { "message",    "The corrected message."})
         CMD_NOEXAMPLES
     },
+
+    { "/slashguard",
+        parse_args, 1, 1, &cons_slashguard_setting,
+        CMD_NOSUBFUNCS
+        CMD_MAINFUNC(cmd_slashguard)
+        CMD_TAGS(
+            CMD_TAG_UI,
+            CMD_TAG_CHAT)
+        CMD_SYN(
+            "/slashguard on|off")
+        CMD_DESC(
+            "Slashguard won't accept a slash in the first 4 characters of your input field. "
+            "It tries to protect you from typing ' /quit' and similar things in chats.")
+        CMD_ARGS(
+            { "on|off", "Enable or disable slashguard." })
+        CMD_NOEXAMPLES
+    },
 };
 
 static GHashTable *search_index;
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 1776c72e..cee58c7a 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -8836,3 +8836,15 @@ cmd_correct(ProfWin *window, const char *const command, gchar **args)
     win_println(window, THEME_DEFAULT, "!", "Command /correct only valid in regular chat windows.");
     return TRUE;
 }
+
+gboolean
+cmd_slashguard(ProfWin *window, const char *const command, gchar **args)
+{
+    if (args[0] == NULL) {
+        return FALSE;
+    }
+
+    _cmd_set_boolean_preference(args[0], command, "Slashguard", PREF_SLASH_GUARD);
+
+    return TRUE;
+}
diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h
index 58d99635..bcb633d2 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -231,4 +231,5 @@ gboolean cmd_avatar(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_os(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_correction(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_correct(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_slashguard(ProfWin *window, const char *const command, gchar **args);
 #endif