changeset 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 e9974608b319
children 2a4b93b57518
files src/connection.c src/connection.h
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
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));
 }
 
--- a/src/connection.h	Wed Aug 06 11:38:57 2003 +0000
+++ b/src/connection.h	Wed Aug 06 14:33:58 2003 +0000
@@ -83,6 +83,7 @@
 	                                  this here?)                        */
 
 	gboolean wants_to_die;	     /**< Wants to Die state.                */
+	guint disconnect_timeout;    /**< Timer used for nasty stack tricks  */
 };
 
 #ifdef __cplusplus