about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorNetboy3 <1472804+netboy3@users.noreply.github.com>2022-07-28 08:24:23 -0400
committerNetboy3 <1472804+netboy3@users.noreply.github.com>2022-07-28 11:48:38 -0400
commit4ea98c71ee0095115db905569fac18a8a82731c1 (patch)
treec6eec64fb219f563276afad754e9e7754a20e202
parent9605334d5a57dfcf6ef367a92574c9901f688bd8 (diff)
downloadprofani-tty-4ea98c71ee0095115db905569fac18a8a82731c1.tar.gz
Fix /autoaway command logic
Two issues were fixed in the parser logic:
* A call to cons_bad_cmd_usage() was placed at the end of the "time"
  parser section that blocked reachability to both "message" and
  "check" parser sections. This caused "/autoaway message ..." and
  "/autoaway check ..." to always fail with "Invalid usage". This
  issue was introduced in commit 3c1e4ba.
* "/autoaway message xa" with no message argument returns message
  set to (null). This should be fixed the same way as
  "/autoaway message away" was fixed in commit 3c1e4ba.
-rw-r--r--src/command/cmd_funcs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 7e08a783..5d3673bb 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -6677,9 +6677,6 @@ cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
             cons_bad_cmd_usage(command);
             return TRUE;
         }
-    } else {
-        cons_bad_cmd_usage(command);
-        return TRUE;
     }
 
     if (g_strcmp0(args[0], "message") == 0) {
@@ -6693,7 +6690,7 @@ cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
             }
 
             return TRUE;
-        } else if (g_strcmp0(args[1], "xa") == 0) {
+        } else if (g_strcmp0(args[1], "xa") == 0 && args[2] != NULL) {
             if (g_strcmp0(args[2], "off") == 0) {
                 prefs_set_string(PREF_AUTOXA_MESSAGE, NULL);
                 cons_show("Auto xa message cleared.");
@@ -6714,6 +6711,7 @@ cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
         return TRUE;
     }
 
+    cons_bad_cmd_usage(command);
     return TRUE;
 }