1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

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.
This commit is contained in:
Netboy3 2022-07-28 08:24:23 -04:00
parent 9605334d5a
commit 4ea98c71ee

View File

@ -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;
}