diff src/protocols/simple/simple.c @ 14118:87ff682bdf5f

[gaim-migrate @ 16752] I don't feel like fixing simple right now, so I'm adding some GAIM_CONNECTION_IS_VALID's to tide us over committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 08:23:26 +0000
parents 7a205b430d19
children 8856312371cb
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Mon Aug 14 08:22:39 2006 +0000
+++ b/src/protocols/simple/simple.c	Mon Aug 14 08:23:26 2006 +0000
@@ -421,16 +421,24 @@
 
 static void simple_input_cb(gpointer data, gint source, GaimInputCondition cond);
 
-static void send_later_cb(gpointer data, gint source) {
+static void send_later_cb(gpointer data, gint source, const gchar *error) {
 	GaimConnection *gc = data;
-	struct simple_account_data *sip = gc->proto_data;
+	struct simple_account_data *sip;
 	struct sip_connection *conn;
 
+	if (!GAIM_CONNECTION_IS_VALID(gc))
+	{
+		if (source >= 0)
+			close(source);
+		return;
+	}
+
 	if(source < 0) {
 		gaim_connection_error(gc, _("Could not connect"));
 		return;
 	}
 
+	sip = gc->proto_data;
 	sip->fd = source;
 	sip->connecting = FALSE;
 
@@ -1453,16 +1461,24 @@
 	conn->inputhandler = gaim_input_add(newfd, GAIM_INPUT_READ, simple_input_cb, gc);
 }
 
-static void login_cb(gpointer data, gint source) {
+static void login_cb(gpointer data, gint source, const gchar *error_message) {
 	GaimConnection *gc = data;
-	struct simple_account_data *sip = gc->proto_data;
+	struct simple_account_data *sip;
 	struct sip_connection *conn;
 
+	if (!GAIM_CONNECTION_IS_VALID(gc))
+	{
+		if (source >= 0)
+			close(source);
+		return;
+	}
+
 	if(source < 0) {
 		gaim_connection_error(gc, _("Could not connect"));
 		return;
 	}
 
+	sip = gc->proto_data;
 	sip->fd = source;
 
 	conn = connection_create(sip, source);