diff src/connection.c @ 6393:74ca311ceb2a

[gaim-migrate @ 6898] This manages to not make jabber (and maybe others) not crash on connection errors and stuff. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 06 Aug 2003 14:33:58 +0000
parents ae8b0a12e6f3
children ff4551719cc7
line wrap: on
line diff
--- a/src/connection.c	Wed Aug 06 11:38:57 2003 +0000
+++ b/src/connection.c	Wed Aug 06 14:33:58 2003 +0000
@@ -82,6 +82,9 @@
 	if (gc->away_state != NULL)
 		g_free(gc->away_state);
 
+	if (gc->disconnect_timeout)
+		g_source_remove(gc->disconnect_timeout);
+
 	g_free(gc);
 }
 
@@ -401,6 +404,10 @@
 	g_return_if_fail(gc   != NULL);
 	g_return_if_fail(text != NULL);
 
+	/* If we've already got one error, we don't need any more */
+	if(gc->disconnect_timeout)
+		return;
+
 	primary = g_strdup_printf(_("%s has been disconnected"),
 				gaim_account_get_username(gaim_connection_get_account(gc)));
 	secondary = g_strdup_printf("%s\n%s", full_date(),
@@ -414,7 +421,7 @@
 	if (ops != NULL && ops->disconnected != NULL)
 		ops->disconnected(gc, text);
 
-	g_timeout_add(0, gaim_connection_disconnect_cb,
+	gc->disconnect_timeout = g_timeout_add(0, gaim_connection_disconnect_cb,
 			gaim_connection_get_account(gc));
 }