changeset 14111:c44af67e2065

[gaim-migrate @ 16745] IRC is now canceling gaim_proxy_connect() attempts instead of using GAIM_CONNECTION_IS_VALID(). This will probably be the most clear example of the changes needed, for you folks sitting at home. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 06:38:12 +0000
parents 5cefeb370262
children e149556f7569
files src/protocols/irc/irc.c src/protocols/irc/irc.h
diffstat 2 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Mon Aug 14 06:27:04 2006 +0000
+++ b/src/protocols/irc/irc.c	Mon Aug 14 06:38:12 2006 +0000
@@ -46,7 +46,7 @@
 /* static GList *irc_chat_info(GaimConnection *gc); */
 static void irc_login(GaimAccount *account);
 static void irc_login_cb_ssl(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond);
-static void irc_login_cb(gpointer data, gint source);
+static void irc_login_cb(gpointer data, gint source, const gchar *error_message);
 static void irc_ssl_connect_failure(GaimSslConnection *gsc, GaimSslErrorType error, gpointer data);
 static void irc_close(GaimConnection *gc);
 static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags);
@@ -283,7 +283,6 @@
 	struct irc_conn *irc;
 	char **userparts;
 	const char *username = gaim_account_get_username(account);
-	GaimProxyConnectInfo *connect_info;
 
 	gc = gaim_account_get_connection(account);
 	gc->flags |= GAIM_CONNECTION_NO_NEWLINES;
@@ -325,11 +324,11 @@
 
 	if (!irc->gsc) {
 
-		connect_info = gaim_proxy_connect(account, irc->server,
+		irc->connect_info = gaim_proxy_connect(account, irc->server,
 				 gaim_account_get_int(account, "port", IRC_DEFAULT_PORT),
 				 irc_login_cb, gc);
 
-		if (!connect_info || !gaim_account_get_connection(account)) {
+		if (!irc->connect_info || !gaim_account_get_connection(account)) {
 			gaim_connection_error(gc, _("Couldn't create socket"));
 			return;
 		}
@@ -394,22 +393,18 @@
 	}
 }
 
-static void irc_login_cb(gpointer data, gint source)
+static void irc_login_cb(gpointer data, gint source, const gchar *error_message)
 {
 	GaimConnection *gc = data;
 	struct irc_conn *irc = gc->proto_data;
-	GList *connections = gaim_connections_get_all();
+
+	irc->connect_info = NULL;
 
 	if (source < 0) {
 		gaim_connection_error(gc, _("Couldn't connect to host"));
 		return;
 	}
 
-	if (!g_list_find(connections, gc)) {
-		close(source);
-		return;
-	}
-
 	irc->fd = source;
 
 	if (do_login(gc)) {
@@ -443,7 +438,11 @@
 	if (irc == NULL)
 		return;
 
-	irc_cmd_quit(irc, "quit", NULL, NULL);
+	if (irc->gsc || (irc->fd >= 0))
+		irc_cmd_quit(irc, "quit", NULL, NULL);
+
+	if (irc->connect_info)
+		gaim_proxy_connect_cancel(irc->connect_info);
 
 	if (gc->inpa)
 		gaim_input_remove(gc->inpa);
--- a/src/protocols/irc/irc.h	Mon Aug 14 06:27:04 2006 +0000
+++ b/src/protocols/irc/irc.h	Mon Aug 14 06:38:12 2006 +0000
@@ -54,6 +54,8 @@
 	guint timer;
 	GHashTable *buddies;
 
+	GaimProxyConnectInfo *connect_info;
+
 	char *inbuf;
 	int inbuflen;
 	int inbufused;