# HG changeset patch # User Mark Doliner # Date 1111882843 0 # Node ID 4228b6d785062d9eda28765b4a40a5d0d824e190 # Parent 2f5d99f963eb0489f337eb4e7518d01fd01fc4e6 [gaim-migrate @ 12344] Combine gaim_connection_destroy and gaim_connection_disconnect committer: Tailor Script diff -r 2f5d99f963eb -r 4228b6d78506 src/account.c --- a/src/account.c Sat Mar 26 23:37:39 2005 +0000 +++ b/src/account.c Sun Mar 27 00:20:43 2005 +0000 @@ -709,8 +709,8 @@ gaim_debug_info("account", "Destroying account %p\n", account); - if (account->gc != NULL) - gaim_connection_destroy(account->gc); + if (gaim_account_is_connected(account)) + gaim_account_disconnect(account); gaim_debug_info("account", "Continuing to destroy account %p\n", account); @@ -831,11 +831,11 @@ gaim_debug_info("account", "Disconnecting account %p\n", account); account->disconnecting = TRUE; - gc = gaim_account_get_connection(account); - gaim_connection_disconnect(gc); + gc = gaim_account_get_connection(account); + gaim_connection_destroy(gc); + gaim_account_set_connection(account, NULL); - gaim_account_set_connection(account, NULL); account->disconnecting = FALSE; } @@ -1031,7 +1031,7 @@ g_free(account->buddy_icon); account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon)); if (gaim_account_is_connected(account)) - serv_set_buddyicon(account->gc, icon); + serv_set_buddyicon(gaim_account_get_connection(account), icon); schedule_accounts_save(); } diff -r 2f5d99f963eb -r 4228b6d78506 src/connection.c --- a/src/connection.c Sat Mar 26 23:37:39 2005 +0000 +++ b/src/connection.c Sun Mar 27 00:20:43 2005 +0000 @@ -117,48 +117,14 @@ g_return_if_fail(gc != NULL); - if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) { - gaim_connection_disconnect(gc); - - return; - } - - gaim_debug_info("connection", "Destroying connection %p\n", gc); - - account = gaim_connection_get_account(gc); - gaim_account_set_connection(account, NULL); - - if (gc->password != NULL) - g_free(gc->password); - - if (gc->display_name != NULL) - g_free(gc->display_name); - - if (gc->disconnect_timeout) - gaim_timeout_remove(gc->disconnect_timeout); - - g_free(gc); -} - -void -gaim_connection_disconnect(GaimConnection *gc) -{ - GaimAccount *account; - GList *wins; - GaimPresence *presence = NULL; - - g_return_if_fail(gc != NULL); - account = gaim_connection_get_account(gc); - if (!account->disconnecting) { - gaim_account_disconnect(account); - return; - } + if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) { + GList *wins; + GaimPresence *presence = NULL; - gaim_debug_info("connection", "Disconnecting connection %p\n", gc); + gaim_debug_info("connection", "Disconnecting connection %p\n", gc); - if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) { if (gaim_connection_get_state(gc) != GAIM_CONNECTING) gaim_blist_remove_account(gaim_connection_get_account(gc)); @@ -190,19 +156,24 @@ gaim_request_close_with_handle(gc); gaim_notify_close_with_handle(gc); + + return; } - gaim_connection_destroy(gc); -} + gaim_debug_info("connection", "Destroying connection %p\n", gc); + + gaim_account_set_connection(account, NULL); + + if (gc->password != NULL) + g_free(gc->password); -gboolean -gaim_connection_disconnect_cb(gpointer data) -{ - GaimAccount *account = data; + if (gc->display_name != NULL) + g_free(gc->display_name); - gaim_account_disconnect(account); + if (gc->disconnect_timeout) + gaim_timeout_remove(gc->disconnect_timeout); - return FALSE; + g_free(gc); } /* @@ -410,6 +381,16 @@ ops->notice(gc, text); } +gboolean +gaim_connection_disconnect_cb(gpointer data) +{ + GaimAccount *account = data; + + gaim_account_disconnect(account); + + return FALSE; +} + void gaim_connection_error(GaimConnection *gc, const char *text) { @@ -442,7 +423,7 @@ while ((l = gaim_connections_get_all()) != NULL) { gc = l->data; gc->wants_to_die = TRUE; - gaim_connection_destroy(gc); + gaim_account_disconnect(gc->account); } } diff -r 2f5d99f963eb -r 4228b6d78506 src/connection.h --- a/src/connection.h Sat Mar 26 23:37:39 2005 +0000 +++ b/src/connection.h Sun Mar 27 00:20:43 2005 +0000 @@ -114,7 +114,7 @@ /*@{*/ /** - * This function should only be called by gaim_connection_connect() + * This function should only be called by gaim_account_connect() * in account.c. If you're trying to sign on an account, use that * function instead. * @@ -134,7 +134,7 @@ const char *password); /** - * This function should only be called by gaim_connection_connect() + * This function should only be called by gaim_account_disconnect() * in account.c. If you're trying to sign on an account, use that * function instead. * @@ -145,19 +145,6 @@ void gaim_connection_destroy(GaimConnection *gc); /** - * This function should only be called by gaim_connection_disconnect() - * in account.c. If you're trying to sign out an account, use that - * function instead. - * - * Logs out of this connection. - * - * @param gc The connection to log out. - * - * @see gaim_connection_connect() - */ -void gaim_connection_disconnect(GaimConnection *gc); - -/** * Sets the connection state. * * @param gc The connection.