changeset 14116:12be86c7e2ce

[gaim-migrate @ 16750] Sametime should be good committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 07:37:11 +0000
parents 8ea1929c4c69
children ae1c155bed57
files src/protocols/sametime/sametime.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/sametime/sametime.c	Mon Aug 14 07:27:41 2006 +0000
+++ b/src/protocols/sametime/sametime.c	Mon Aug 14 07:37:11 2006 +0000
@@ -226,6 +226,7 @@
   /** socket fd */
   int socket;
   gint outpa;  /* like inpa, but the other way */
+  GaimProxyConnectInfo *connect_info;
 
   /** circular buffer for outgoing data */
   GaimCircBuffer *sock_buf;
@@ -310,7 +311,7 @@
 
 /* connection functions */
 
-static void connect_cb(gpointer data, gint source);
+static void connect_cb(gpointer data, gint source, const gchar *error_message);
 
 
 /* ----- session ------ */
@@ -1669,15 +1670,12 @@
 
 /** Callback passed to gaim_proxy_connect when an account is logged
     in, and if the session logging in receives a redirect message */
-static void connect_cb(gpointer data, gint source) {
+static void connect_cb(gpointer data, gint source, const gchar *error_message) {
 
   struct mwGaimPluginData *pd = data;
   GaimConnection *gc = pd->gc;
 
-  if(! g_list_find(gaim_connections_get_all(), pd->gc)) {
-    close(source);
-    g_return_if_reached();
-  }
+  pd->connect_info = NULL;
 
   if(source < 0) {
     /* connection failed */
@@ -3683,7 +3681,8 @@
 
   gaim_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS);
 
-  if(gaim_proxy_connect(account, host, port, connect_cb, pd) == NULL) {
+  pd->connect_info = gaim_proxy_connect(account, host, port, connect_cb, pd);
+  if(pd->connect_info == NULL) {
     gaim_connection_error(gc, _("Unable to connect to host"));
   }
 }
@@ -3716,6 +3715,11 @@
     gc->inpa = 0;
   }
 
+  if(pd->connect_info != NULL) {
+    gaim_proxy_connect_cancel(pd->connect_info);
+    pd->connect_info = NULL;
+  }
+
   /* clean up the rest */
   mwGaimPluginData_free(pd);
 }