mirror of
https://github.com/profanity-im/profanity.git
synced 2025-07-26 12:14:28 -04:00
Check for sane argument in autoconnect set
Check that user doesnt do `/autoconnect set `. Which would result in: `Account '(null)' does not exist`.
This commit is contained in:
parent
53ef209272
commit
4e972f8aef
@ -6555,11 +6555,15 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
|
|||||||
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
|
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
|
||||||
cons_show("Autoconnect account disabled.");
|
cons_show("Autoconnect account disabled.");
|
||||||
} else if (strcmp(args[0], "set") == 0) {
|
} else if (strcmp(args[0], "set") == 0) {
|
||||||
if (accounts_account_exists(args[1])) {
|
if (args[1] == NULL || strlen(args[1]) == 0) {
|
||||||
prefs_set_string(PREF_CONNECT_ACCOUNT, args[1]);
|
cons_bad_cmd_usage(command);
|
||||||
cons_show("Autoconnect account set to: %s.", args[1]);
|
|
||||||
} else {
|
} else {
|
||||||
cons_show_error("Account '%s' does not exist.", args[1]);
|
if (accounts_account_exists(args[1])) {
|
||||||
|
prefs_set_string(PREF_CONNECT_ACCOUNT, args[1]);
|
||||||
|
cons_show("Autoconnect account set to: %s.", args[1]);
|
||||||
|
} else {
|
||||||
|
cons_show_error("Account '%s' does not exist.", args[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user