Index: protocols/http_client.c
===================================================================
--- protocols/http_client.c	(revision 1b5ab3608488e0cbbc75933a59af1fa7e2ff60b0)
+++ protocols/http_client.c	(revision ba9edaa568088900145bbd1004c864b7d408c38d)
@@ -32,7 +32,7 @@
 
 
-static void http_connected( gpointer data, int source, GaimInputCondition cond );
-static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond );
-static void http_incoming_data( gpointer data, int source, GaimInputCondition cond );
+static gboolean http_connected( gpointer data, int source, b_input_condition cond );
+static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond );
+static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond );
 
 
@@ -71,38 +71,7 @@
 }
 
-void *http_dorequest_url( char *url_string, http_input_function func, gpointer data )
-{
-	url_t *url = g_new0( url_t, 1 );
-	char *request;
-	void *ret;
-	
-	if( !url_set( url, url_string ) )
-	{
-		g_free( url );
-		return NULL;
-	}
-	
-	if( url->proto != PROTO_HTTP && url->proto != PROTO_HTTPS )
-	{
-		g_free( url );
-		return NULL;
-	}
-	
-	request = g_strdup_printf( "GET %s HTTP/1.0\r\n"
-	                           "Host: %s\r\n"
-	                           "User-Agent: BitlBee " BITLBEE_VERSION " " ARCH "/" CPU "\r\n"
-	                           "\r\n", url->file, url->host );
-	
-	ret = http_dorequest( url->host, url->port,
-	                      url->proto == PROTO_HTTPS, request, func, data );
-	
-	g_free( url );
-	g_free( request );
-	return ret;
-}
-
 /* This one is actually pretty simple... Might get more calls if we can't write 
    the whole request at once. */
-static void http_connected( gpointer data, int source, GaimInputCondition cond )
+static gboolean http_connected( gpointer data, int source, b_input_condition cond )
 {
 	struct http_request *req = data;
@@ -113,5 +82,5 @@
 	
 	if( req->inpa > 0 )
-		gaim_input_remove( req->inpa );
+		b_event_remove( req->inpa );
 	
 	sock_make_nonblocking( req->fd );
@@ -148,11 +117,11 @@
 	
 	if( req->bytes_written < req->request_length )
-		req->inpa = gaim_input_add( source,
-		                            req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
-	        	                    http_connected, req );
-	else
-		req->inpa = gaim_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
-	
-	return;
+		req->inpa = b_input_add( source,
+		                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
+	        	                 http_connected, req );
+	else
+		req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
+	
+	return FALSE;
 	
 error:
@@ -162,8 +131,8 @@
 	g_free( req );
 	
-	return;
+	return FALSE;
 }
 
-static void http_ssl_connected( gpointer data, void *source, GaimInputCondition cond )
+static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond )
 {
 	struct http_request *req = data;
@@ -177,5 +146,5 @@
 }
 
-static void http_incoming_data( gpointer data, int source, GaimInputCondition cond )
+static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond )
 {
 	struct http_request *req = data;
@@ -186,5 +155,5 @@
 	
 	if( req->inpa > 0 )
-		gaim_input_remove( req->inpa );
+		b_event_remove( req->inpa );
 	
 	if( req->ssl )
@@ -233,9 +202,9 @@
 	
 	/* There will be more! */
-	req->inpa = gaim_input_add( req->fd,
-	                            req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
-	                            http_incoming_data, req );
-	
-	return;
+	req->inpa = b_input_add( req->fd,
+	                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
+	                         http_incoming_data, req );
+	
+	return FALSE;
 
 got_reply:
@@ -253,21 +222,18 @@
 		evil_server = 1;
 	}
-	else if( end1 )
+	else
 	{
 		end1 += 2;
 	}
-	else
-	{
-		goto cleanup;
-	}
-	
-	*end1 = 0;
-	
-	if( evil_server )
-		req->reply_body = end1 + 1;
-	else
-		req->reply_body = end1 + 2;
-	
-	req->body_size = req->reply_headers + req->bytes_read - req->reply_body;
+	
+	if( end1 )
+	{
+		*end1 = 0;
+		
+		if( evil_server )
+			req->reply_body = end1 + 1;
+		else
+			req->reply_body = end1 + 2;
+	}
 	
 	if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL )
@@ -396,5 +362,5 @@
 		req->reply_headers = req->reply_body = NULL;
 		
-		return;
+		return FALSE;
 	}
 	
@@ -414,3 +380,5 @@
 	g_free( req->reply_headers );
 	g_free( req );
+	
+	return FALSE;
 }
