diff src/proxy.c @ 14108:7a205b430d19

[gaim-migrate @ 16742] Removing the "error_cb" parameter for gaim_proxy_connect(), changing it back to how it was. As I started making changes to oscar to support canceling connection attempts, I realized that having a separate callback for errors would result in more code duplication than was needed. Originally I thought the separate callback would make things cleaner. Anyway, sorry for the noise. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 04:43:38 +0000
parents eec0c7fd8529
children c3167a1dd817
line wrap: on
line diff
--- a/src/proxy.c	Mon Aug 14 02:16:58 2006 +0000
+++ b/src/proxy.c	Mon Aug 14 04:43:38 2006 +0000
@@ -40,7 +40,6 @@
 
 struct _GaimProxyConnectInfo {
 	GaimProxyConnectFunction connect_cb;
-	GaimProxyErrorFunction error_cb;
 	gpointer data;
 	char *host;
 	int port;
@@ -324,7 +323,7 @@
 static void
 gaim_proxy_connect_info_connected(GaimProxyConnectInfo *connect_info)
 {
-	connect_info->connect_cb(connect_info->data, connect_info->fd);
+	connect_info->connect_cb(connect_info->data, connect_info->fd, NULL);
 
 	/*
 	 * We've passed the file descriptor to the protocol, so it's no longer
@@ -348,22 +347,7 @@
 static void
 gaim_proxy_connect_info_error(GaimProxyConnectInfo *connect_info, const gchar *error_message)
 {
-	if (connect_info->error_cb == NULL)
-	{
-		/*
-		 * TODO
-		 * While we're transitioning to the new gaim_proxy_connect()
-		 * code, not all callers supply an error_cb.  If this is the
-		 * case then they're expecting connect_cb to be called with
-		 * an fd of -1 in the case of an error.  Once all callers have
-		 * been changed this whole if statement should be removed.
-		 */
-		connect_info->connect_cb(connect_info->data, -1);
-		gaim_proxy_connect_info_destroy(connect_info);
-		return;
-	}
-
-	connect_info->error_cb(connect_info->data, error_message);
+	connect_info->connect_cb(connect_info->data, -1, error_message);
 	gaim_proxy_connect_info_destroy(connect_info);
 }
 
@@ -2339,8 +2323,7 @@
 
 GaimProxyConnectInfo *
 gaim_proxy_connect(GaimAccount *account, const char *host, int port,
-				   GaimProxyConnectFunction connect_cb,
-				   GaimProxyErrorFunction error_cb, gpointer data)
+				   GaimProxyConnectFunction connect_cb, gpointer data)
 {
 	const char *connecthost = host;
 	int connectport = port;
@@ -2349,12 +2332,10 @@
 	g_return_val_if_fail(host       != NULL, NULL);
 	g_return_val_if_fail(port       >  0,    NULL);
 	g_return_val_if_fail(connect_cb != NULL, NULL);
-	/* g_return_val_if_fail(error_cb   != NULL, NULL); *//* TODO: Soon! */
 
 	connect_info = g_new0(GaimProxyConnectInfo, 1);
 	connect_info->fd = -1;
 	connect_info->connect_cb = connect_cb;
-	connect_info->error_cb = error_cb;
 	connect_info->data = data;
 	connect_info->host = g_strdup(host);
 	connect_info->port = port;
@@ -2404,20 +2385,17 @@
  */
 GaimProxyConnectInfo *
 gaim_proxy_connect_socks5(GaimProxyInfo *gpi, const char *host, int port,
-				   GaimProxyConnectFunction connect_cb,
-				   GaimProxyErrorFunction error_cb, gpointer data)
+				   GaimProxyConnectFunction connect_cb, gpointer data)
 {
 	GaimProxyConnectInfo *connect_info;
 
 	g_return_val_if_fail(host       != NULL, NULL);
 	g_return_val_if_fail(port       >  0,    NULL);
 	g_return_val_if_fail(connect_cb != NULL, NULL);
-	/* g_return_val_if_fail(error_cb   != NULL, NULL); *//* TODO: Soon! */
 
 	connect_info = g_new0(GaimProxyConnectInfo, 1);
 	connect_info->fd = -1;
 	connect_info->connect_cb = connect_cb;
-	connect_info->error_cb = error_cb;
 	connect_info->data = data;
 	connect_info->host = g_strdup(host);
 	connect_info->port = port;