comparison src/account.c @ 10720:0e017707532f

[gaim-migrate @ 12318] We can now sign on and off and on and off accounts all the live long day using the "enabled" button in the accounts window committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 24 Mar 2005 04:36:09 +0000
parents ad57a8b5495e
children 55af3fa46329
comparison
equal deleted inserted replaced
10719:1da76f22c750 10720:0e017707532f
582 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, 582 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
583 g_free, delete_setting); 583 g_free, delete_setting);
584 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, 584 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal,
585 g_free, (GDestroyNotify)g_hash_table_destroy); 585 g_free, (GDestroyNotify)g_hash_table_destroy);
586 account->system_log = NULL; 586 account->system_log = NULL;
587 587
588 account->presence = gaim_presence_new_for_account(account); 588 account->presence = gaim_presence_new_for_account(account);
589 589
590 prpl = gaim_find_prpl(protocol_id); 590 prpl = gaim_find_prpl(protocol_id);
591 591
592 if (prpl == NULL) 592 if (prpl == NULL)
996 996
997 g_return_if_fail(account != NULL); 997 g_return_if_fail(account != NULL);
998 g_return_if_fail(status_id != NULL); 998 g_return_if_fail(status_id != NULL);
999 999
1000 status = gaim_account_get_status(account, status_id); 1000 status = gaim_account_get_status(account, status_id);
1001
1002 if (status == NULL) 1001 if (status == NULL)
1003 { 1002 {
1004 gaim_debug_error("accounts", 1003 gaim_debug_error("accounts",
1005 "Invalid status ID %s for account %s (%s)\n", 1004 "Invalid status ID %s for account %s (%s)\n",
1006 status_id, gaim_account_get_username(account), 1005 status_id, gaim_account_get_username(account),
1007 gaim_account_get_protocol_id(account)); 1006 gaim_account_get_protocol_id(account));
1008 return; 1007 return;
1009 } 1008 }
1009 status_type = gaim_status_get_type(status);
1010
1011 /*
1012 * If this account should be disconnected, but is online, then disconnect.
1013 */
1014 if (active &&
1015 (gaim_status_type_get_primitive(status_type) == GAIM_STATUS_OFFLINE) &&
1016 gaim_account_is_connected(account))
1017 {
1018 gaim_account_disconnect(account);
1019
1020 /* No need to actually set the status, so we just exit */
1021 return;
1022 }
1023
1024 /* TODO: Record the status in accounts.xml? */
1010 1025
1011 va_start(args, active); 1026 va_start(args, active);
1012 gaim_status_set_active_with_attrs(status, active, args); 1027 gaim_status_set_active_with_attrs(status, active, args);
1013 va_end(args); 1028 va_end(args);
1014 1029
1015 /* 1030 /*
1016 * If this account should be connected, but is not, then connect. 1031 * If this account should be connected, but is not, then connect.
1017 */ 1032 */
1018 status_type = gaim_status_get_type(status);
1019 if (active && 1033 if (active &&
1020 (gaim_status_type_get_primitive(status_type) != GAIM_STATUS_OFFLINE) && 1034 (gaim_status_type_get_primitive(status_type) != GAIM_STATUS_OFFLINE) &&
1021 !gaim_account_is_connected(account)) 1035 !gaim_account_is_connected(account))
1022 { 1036 {
1023 gaim_account_connect(account, status); 1037 gaim_account_connect(account, status);