pidgin/pidgin

Parents 01c052e10f4b
Children d25e0133b9ea
Work around a timing issues with accounts that have no passwords.

There will be a better fix for this, but it's going to be a bit involved. The
problem stems from `purple_account_set_enabled` which is bringing the account
online as soon as that is set. At startup, the accounts are unserialized from
accounts.xml, which sets the enabled property, which causes the account to
connect before the rest of the core is started.

Testing Done:
Started pidgin3 with an account that fails to connect 100% of the time and verified nothing crashed.

Reviewed at https://reviews.imfreedom.org/r/1896/
--- a/libpurple/account.c Wed Oct 05 22:04:08 2022 -0500
+++ b/libpurple/account.c Wed Oct 05 22:05:17 2022 -0500
@@ -381,6 +381,15 @@
purple_account_change_password(account, orig_pass, new_pass_1);
}
+static gboolean
+no_password_cb(gpointer data) {
+ PurpleAccount *account = data;
+
+ _purple_connection_new(account, FALSE, NULL);
+
+ return G_SOURCE_REMOVE;
+}
+
static void
set_user_info_cb(PurpleAccount *account, const char *user_info)
{
@@ -1100,7 +1109,7 @@
purple_account_connect_got_password_cb,
account);
} else {
- _purple_connection_new(account, FALSE, NULL);
+ g_timeout_add_seconds(0, no_password_cb, account);
}
}