changeset 5740:6ec7b32ab1df

[gaim-migrate @ 6164] Hopefully fixed an infinite loop bug on disconnect, but I'm not holding my breath. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 04 Jun 2003 07:28:36 +0000
parents edf4d443e671
children 1b5e6e6e80e9
files src/connection.c
diffstat 1 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/connection.c	Wed Jun 04 07:26:04 2003 +0000
+++ b/src/connection.c	Wed Jun 04 07:28:36 2003 +0000
@@ -111,35 +111,37 @@
 	GList *wins;
 
 	g_return_if_fail(gc != NULL);
-	g_return_if_fail(gaim_connection_get_state(gc) != GAIM_DISCONNECTED);
 
-	if (gaim_connection_get_state(gc) != GAIM_CONNECTING)
-		gaim_blist_remove_account(gaim_connection_get_account(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));
 
-	serv_close(gc);
+		serv_close(gc);
 
-	gaim_connection_set_state(gc, GAIM_DISCONNECTED);
+		gaim_connection_set_state(gc, GAIM_DISCONNECTED);
+
+		connections = g_list_remove(connections, gc);
 
-	connections = g_list_remove(connections, gc);
-
-	gaim_event_broadcast(event_signoff, gc);
-	system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
+		gaim_event_broadcast(event_signoff, gc);
+		system_log(log_signoff, gc, NULL,
+				   OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
 
-	/*
-	 * XXX This is a hack! Remove this and replace it with a better event
-	 *     notification system.
-	 */
-	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
-		GaimWindow *win = (GaimWindow *)wins->data;
-		gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
-								 GAIM_CONV_ACCOUNT_OFFLINE);
+		/*
+		 * XXX This is a hack! Remove this and replace it with a better event
+		 *     notification system.
+		 */
+		for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
+			GaimWindow *win = (GaimWindow *)wins->data;
+			gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
+									 GAIM_CONV_ACCOUNT_OFFLINE);
+		}
+
+		gaim_request_close_with_handle(gc);
+		gaim_notify_close_with_handle(gc);
+
+		update_privacy_connections();
 	}
 
-	gaim_request_close_with_handle(gc);
-	gaim_notify_close_with_handle(gc);
-
-	update_privacy_connections();
-
 	gaim_connection_destroy(gc);
 
 	/* XXX More UI stuff! */