# HG changeset patch # User Mark Doliner # Date 1125031116 0 # Node ID efb358543b1d9d09c2c5d75621f9f23233122dda # Parent 6c1ad49fcb4b809c33f99312b36ee3da7c3b5f0c [gaim-migrate @ 13565] Two changes: 1. Fix the "enabled" button in the accounts editor so that unchecking it will sign off an account. I broke this in one of my commits on August 17th 2. Some changes from Thomas Butter to finishing initializing Gaim, and THEN attempt to sign on accounts. This fixes problems with the crypto API not yet being initialized. committer: Tailor Script diff -r 6c1ad49fcb4b -r efb358543b1d src/account.c --- a/src/account.c Fri Aug 26 03:21:03 2005 +0000 +++ b/src/account.c Fri Aug 26 04:38:36 2005 +0000 @@ -781,12 +781,6 @@ GaimAccount *new_acct; new_acct = parse_account(child); gaim_accounts_add(new_acct); - - if (gaim_account_get_enabled(new_acct, gaim_core_get_ui()) && - (gaim_presence_is_online(new_acct->presence))) - { - gaim_account_connect(new_acct); - } } } @@ -1295,6 +1289,8 @@ gaim_account_set_ui_bool(account, ui, "auto-login", value); if (value && gaim_presence_is_online(account->presence)) gaim_account_connect(account); + else if (!value && !gaim_account_is_disconnected(account)) + gaim_account_disconnect(account); } void @@ -2060,6 +2056,23 @@ } void +gaim_accounts_restore_previous_statuses() +{ + GList *l; + GaimAccount *account; + + for (l = gaim_accounts_get_all(); l != NULL; l = l->next) + { + account = (GaimAccount *)l->data; + if (gaim_account_get_enabled(account, gaim_core_get_ui()) && + (gaim_presence_is_online(account->presence))) + { + gaim_account_connect(account); + } + } +} + +void gaim_accounts_set_ui_ops(GaimAccountUiOps *ops) { account_ui_ops = ops; diff -r 6c1ad49fcb4b -r efb358543b1d src/account.h --- a/src/account.h Fri Aug 26 03:21:03 2005 +0000 +++ b/src/account.h Fri Aug 26 04:38:36 2005 +0000 @@ -746,6 +746,17 @@ */ GaimAccount *gaim_accounts_find(const char *name, const char *protocol); +/** + * This is called by the core after all subsystems and what + * not have been initialized. It sets all enabled accounts + * to their previous status by signing them on, setting them + * away, etc. + * + * You probably shouldn't call this unless you really know + * what you're doing. + */ +void gaim_accounts_restore_previous_statuses(); + /*@}*/ diff -r 6c1ad49fcb4b -r efb358543b1d src/gtkmain.c --- a/src/gtkmain.c Fri Aug 26 03:21:03 2005 +0000 +++ b/src/gtkmain.c Fri Aug 26 04:38:36 2005 +0000 @@ -672,9 +672,10 @@ } } - if (!opt_acct && opt_nologin) + if (!opt_acct && !opt_nologin) { - /* TODO: Need to disable all accounts or set them all to offline */ + /* Everything is good to go--sign on already */ + gaim_accounts_restore_previous_statuses(); } if (opt_acct || (gaim_accounts_get_all() == NULL)) {