changeset 14117:ae1c155bed57

[gaim-migrate @ 16751] This should take care of the silc gaim_proxy_connect()s committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 08:22:39 +0000
parents 12be86c7e2ce
children 87ff682bdf5f
files src/protocols/silc/silc.c src/protocols/silc/silcgaim.h
diffstat 2 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/silc/silc.c	Mon Aug 14 07:37:11 2006 +0000
+++ b/src/protocols/silc/silc.c	Mon Aug 14 08:22:39 2006 +0000
@@ -141,7 +141,7 @@
 }
 
 static void
-silcgaim_login_connected(gpointer data, gint source)
+silcgaim_login_connected(gpointer data, gint source, const gchar *error_message)
 {
 	GaimConnection *gc = data;
 	SilcGaim sg;
@@ -153,20 +153,14 @@
 
 	g_return_if_fail(gc != NULL);
 
-	if (!GAIM_CONNECTION_IS_VALID(gc)) {
-		close(source);
-		return;
-	}
+	sg = gc->proto_data;
+	sg->connect_info = NULL;
 
 	if (source < 0) {
 		gaim_connection_error(gc, _("Connection failed"));
 		return;
 	}
 
-	sg = gc->proto_data;
-	if (sg == NULL)
-		return;
-
 	client = sg->client;
 	account = sg->account;
 
@@ -363,11 +357,12 @@
 	gc->proto_data = sg;
 
 	/* Connect to the SILC server */
-	if (gaim_proxy_connect(account,
+	sg->connect_info = gaim_proxy_connect(account,
 			       gaim_account_get_string(account, "server",
 						       "silc.silcnet.org"),
 			       gaim_account_get_int(account, "port", 706),
-			       silcgaim_login_connected, gc) == NULL)
+			       silcgaim_login_connected, gc);
+	if (sg->connect_info == NULL)
 	{
 		gaim_connection_error(gc, _("Unable to create connection"));
 		return;
@@ -387,6 +382,8 @@
 	SilcGaim sg = (SilcGaim)context;
 	silc_client_stop(sg->client);
 	silc_client_free(sg->client);
+	if (sg->connect_info != NULL)
+		gaim_proxy_connect_cancel(sg->connect_info);
 #ifdef HAVE_SILCMIME_H
 	if (sg->mimeass)
 		silc_mime_assembler_free(sg->mimeass);
--- a/src/protocols/silc/silcgaim.h	Mon Aug 14 07:37:11 2006 +0000
+++ b/src/protocols/silc/silcgaim.h	Mon Aug 14 08:22:39 2006 +0000
@@ -67,6 +67,7 @@
 	SilcClient client;
 	SilcClientConnection conn;
 
+	GaimProxyConnectInfo *connect_info;
 	guint scheduler;
 	GaimConnection *gc;
 	GaimAccount *account;