From 5765edbe1b88c70523d1d7d10bd0bd98ac17914b Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 20 Jun 2024 11:04:20 +0200 Subject: [PATCH] Reset autoconnect account when the account gets removed When a user added an account, set it as autoconnect and then removed that account. It still was set as the autoconnect account. ``` /account add test /autoconnect set test /account remove test /save /quit Start profanity ``` Fix https://github.com/profanity-im/profanity/issues/1976 --- src/command/cmd_funcs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 7a0700e2..1f22acae 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -569,6 +569,12 @@ cmd_account_remove(ProfWin* window, const char* const command, gchar** args) } cons_show(""); + auto_gchar gchar* autocon_account = prefs_get_string(PREF_CONNECT_ACCOUNT); + if (g_strcmp0(account_name, autocon_account) == 0) { + prefs_set_string(PREF_CONNECT_ACCOUNT, NULL); + cons_show("Autoconnect account reset because the corresponding account was removed."); + } + return TRUE; }