Index: bitlbee.c
===================================================================
--- bitlbee.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ bitlbee.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -93,5 +93,5 @@
 	}
 	
-	global.listen_watch_source_id = b_input_add( global.listen_socket, GAIM_INPUT_READ, bitlbee_io_new_client, NULL );
+	global.listen_watch_source_id = b_input_add( global.listen_socket, B_EV_IO_READ, bitlbee_io_new_client, NULL );
 	
 #ifndef _WIN32
@@ -284,5 +284,5 @@
 			child->pid = client_pid;
 			child->ipc_fd = fds[0];
-			child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
+			child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
 			child_list = g_slist_append( child_list, child );
 			
@@ -312,5 +312,5 @@
 			/* We can store the IPC fd there now. */
 			global.listen_socket = fds[1];
-			global.listen_watch_source_id = b_input_add( fds[1], GAIM_INPUT_READ, ipc_child_read, irc );
+			global.listen_watch_source_id = b_input_add( fds[1], B_EV_IO_READ, ipc_child_read, irc );
 			
 			close( fds[0] );
Index: ipc.c
===================================================================
--- ipc.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ ipc.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -514,5 +514,5 @@
 	}
 		
-	child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
+	child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
 	
 	child_list = g_slist_append( child_list, child );
@@ -552,5 +552,5 @@
 	}
 	
-	b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
+	b_input_add( serversock, B_EV_IO_READ, new_ipc_client, NULL );
 	
 	return 1;
@@ -597,5 +597,5 @@
 			return 0;
 		}
-		child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
+		child->ipc_inpa = b_input_add( child->ipc_fd, B_EV_IO_READ, ipc_master_read, child );
 		
 		child_list = g_slist_append( child_list, child );
Index: irc.c
===================================================================
--- irc.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ irc.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -90,5 +90,5 @@
 	sock_make_nonblocking( irc->fd );
 	
-	irc->r_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_READ, bitlbee_io_current_client_read, irc );
+	irc->r_watch_source_id = b_input_add( irc->fd, B_EV_IO_READ, bitlbee_io_current_client_read, irc );
 	
 	irc->status = USTATUS_OFFLINE;
@@ -653,8 +653,8 @@
 		   in the event queue. */
 		/* Really can't be done as long as the code doesn't do error checking very well:
-		if( bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE ) ) */
+		if( bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE ) ) */
 		
 		/* So just always do it via the event handler. */
-		irc->w_watch_source_id = b_input_add( irc->fd, GAIM_INPUT_WRITE, bitlbee_io_current_client_write, irc );
+		irc->w_watch_source_id = b_input_add( irc->fd, B_EV_IO_WRITE, bitlbee_io_current_client_write, irc );
 	}
 	
@@ -682,5 +682,5 @@
 		if( now )
 		{
-			bitlbee_io_current_client_write( irc, irc->fd, GAIM_INPUT_WRITE );
+			bitlbee_io_current_client_write( irc, irc->fd, B_EV_IO_WRITE );
 		}
 		temp = temp->next;
Index: lib/events.h
===================================================================
--- lib/events.h	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/events.h	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -48,6 +48,6 @@
    the given callback function. */
 typedef enum {
-	GAIM_INPUT_READ = 1 << 1,
-	GAIM_INPUT_WRITE = 1 << 2
+	B_EV_IO_READ = 1 << 0,
+	B_EV_IO_WRITE = 1 << 1
 } b_input_condition;
 typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond);
Index: lib/events_glib.c
===================================================================
--- lib/events_glib.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/events_glib.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -76,7 +76,7 @@
 
 	if (condition & GAIM_READ_COND)
-		gaim_cond |= GAIM_INPUT_READ;
+		gaim_cond |= B_EV_IO_READ;
 	if (condition & GAIM_WRITE_COND)
-		gaim_cond |= GAIM_INPUT_WRITE;
+		gaim_cond |= B_EV_IO_WRITE;
 	
 	event_debug( "gaim_io_invoke( %d, %d, 0x%x )\n", g_io_channel_unix_get_fd(source), condition, data );
@@ -106,7 +106,7 @@
 	closure->data = data;
 	
-	if (condition & GAIM_INPUT_READ)
+	if (condition & B_EV_IO_READ)
 		cond |= GAIM_READ_COND;
-	if (condition & GAIM_INPUT_WRITE)
+	if (condition & B_EV_IO_WRITE)
 		cond |= GAIM_WRITE_COND;
 	
Index: lib/events_libevent.c
===================================================================
--- lib/events_libevent.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/events_libevent.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -126,7 +126,7 @@
 	{
 		if( event & EV_READ )
-			cond |= GAIM_INPUT_READ;
+			cond |= B_EV_IO_READ;
 		if( event & EV_WRITE )
-			cond |= GAIM_INPUT_WRITE;
+			cond |= B_EV_IO_WRITE;
 	}
 	
@@ -174,6 +174,6 @@
 	event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) ", fd, condition, function, data );
 	
-	if( ( condition & GAIM_INPUT_READ  && ( b_ev = g_hash_table_lookup( read_hash,  &fd ) ) ) ||
-	    ( condition & GAIM_INPUT_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )
+	if( ( condition & B_EV_IO_READ  && ( b_ev = g_hash_table_lookup( read_hash,  &fd ) ) ) ||
+	    ( condition & B_EV_IO_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )
 	{
 		/* We'll stick with this libevent entry, but give it a new BitlBee id. */
@@ -198,7 +198,7 @@
 		
 		out_cond = EV_PERSIST;
-		if( condition & GAIM_INPUT_READ )
+		if( condition & B_EV_IO_READ )
 			out_cond |= EV_READ;
-		if( condition & GAIM_INPUT_WRITE )
+		if( condition & B_EV_IO_WRITE )
 			out_cond |= EV_WRITE;
 		
Index: lib/http_client.c
===================================================================
--- lib/http_client.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/http_client.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -149,8 +149,8 @@
 	if( req->bytes_written < req->request_length )
 		req->inpa = b_input_add( source,
-		                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,
+		                         req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_WRITE,
 	        	                 http_connected, req );
 	else
-		req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );
+		req->inpa = b_input_add( source, B_EV_IO_READ, http_incoming_data, req );
 	
 	return FALSE;
@@ -234,5 +234,5 @@
 	/* There will be more! */
 	req->inpa = b_input_add( req->fd,
-	                         req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,
+	                         req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_READ,
 	                         http_incoming_data, req );
 	
Index: lib/proxy.c
===================================================================
--- lib/proxy.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/proxy.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -91,7 +91,7 @@
 		b_event_remove(phb->inpa);
 		if( phb->proxy_func )
-			phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ);
+			phb->proxy_func(phb->proxy_data, -1, B_EV_IO_READ);
 		else {
-			phb->func(phb->data, -1, GAIM_INPUT_READ);
+			phb->func(phb->data, -1, B_EV_IO_READ);
 			g_free(phb);
 		}
@@ -102,7 +102,7 @@
 	b_event_remove(phb->inpa);
 	if( phb->proxy_func )
-		phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ);
+		phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ);
 	else {
-		phb->func(phb->data, source, GAIM_INPUT_READ);
+		phb->func(phb->data, source, B_EV_IO_READ);
 		g_free(phb);
 	}
@@ -147,5 +147,5 @@
 		return -1;
 	} else {
-		phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
+		phb->inpa = b_input_add(fd, B_EV_IO_WRITE, gaim_io_connected, phb);
 		phb->fd = fd;
 		
@@ -179,5 +179,5 @@
 	if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING)) == 0) ||
 	    (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) {
-		phb->func(phb->data, source, GAIM_INPUT_READ);
+		phb->func(phb->data, source, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -186,5 +186,5 @@
 
 	close(source);
-	phb->func(phb->data, -1, GAIM_INPUT_READ);
+	phb->func(phb->data, -1, B_EV_IO_READ);
 	g_free(phb->host);
 	g_free(phb);
@@ -204,5 +204,5 @@
 	if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -215,5 +215,5 @@
 	if (send(source, cmd, strlen(cmd), 0) < 0) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -230,5 +230,5 @@
 		if (send(source, cmd, strlen(cmd), 0) < 0) {
 			close(source);
-			phb->func(phb->data, -1, GAIM_INPUT_READ);
+			phb->func(phb->data, -1, B_EV_IO_READ);
 			g_free(phb->host);
 			g_free(phb);
@@ -240,11 +240,11 @@
 	if (send(source, cmd, strlen(cmd), 0) < 0) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
-		g_free(phb->host);
-		g_free(phb);
-		return FALSE;
-	}
-
-	phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb);
+		phb->func(phb->data, -1, B_EV_IO_READ);
+		g_free(phb->host);
+		g_free(phb);
+		return FALSE;
+	}
+
+	phb->inpa = b_input_add(source, B_EV_IO_READ, http_canread, phb);
 	
 	return FALSE;
@@ -273,5 +273,5 @@
 	memset(packet, 0, sizeof(packet));
 	if (read(source, packet, 9) >= 4 && packet[1] == 90) {
-		phb->func(phb->data, source, GAIM_INPUT_READ);
+		phb->func(phb->data, source, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -280,5 +280,5 @@
 
 	close(source);
-	phb->func(phb->data, -1, GAIM_INPUT_READ);
+	phb->func(phb->data, -1, B_EV_IO_READ);
 	g_free(phb->host);
 	g_free(phb);
@@ -299,5 +299,5 @@
 	if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -309,5 +309,5 @@
 	if (!(hp = gethostbyname(phb->host))) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -326,11 +326,11 @@
 	if (write(source, packet, 9) != 9) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
-		g_free(phb->host);
-		g_free(phb);
-		return FALSE;
-	}
-
-	phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
+		phb->func(phb->data, -1, B_EV_IO_READ);
+		g_free(phb->host);
+		g_free(phb);
+		return FALSE;
+	}
+
+	phb->inpa = b_input_add(source, B_EV_IO_READ, s4_canread, phb);
 	
 	return FALSE;
@@ -359,5 +359,5 @@
 	if (read(source, buf, 10) < 10) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -366,11 +366,11 @@
 	if ((buf[0] != 0x05) || (buf[1] != 0x00)) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
-		g_free(phb->host);
-		g_free(phb);
-		return FALSE;
-	}
-
-	phb->func(phb->data, source, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
+		g_free(phb->host);
+		g_free(phb);
+		return FALSE;
+	}
+
+	phb->func(phb->data, source, B_EV_IO_READ);
 	g_free(phb->host);
 	g_free(phb);
@@ -396,5 +396,5 @@
 	if (write(source, buf, (5 + strlen(phb->host) + 2)) < (5 + strlen(phb->host) + 2)) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -402,5 +402,5 @@
 	}
 
-	phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);
+	phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread_again, phb);
 }
 
@@ -414,5 +414,5 @@
 	if (read(source, buf, 2) < 2) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -422,5 +422,5 @@
 	if ((buf[0] != 0x01) || (buf[1] != 0x00)) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -442,5 +442,5 @@
 	if (read(source, buf, 2) < 2) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -450,5 +450,5 @@
 	if ((buf[0] != 0x05) || (buf[1] == 0xff)) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -465,5 +465,5 @@
 		if (write(source, buf, 3 + i + j) < 3 + i + j) {
 			close(source);
-			phb->func(phb->data, -1, GAIM_INPUT_READ);
+			phb->func(phb->data, -1, B_EV_IO_READ);
 			g_free(phb->host);
 			g_free(phb);
@@ -471,5 +471,5 @@
 		}
 
-		phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);
+		phb->inpa = b_input_add(source, B_EV_IO_READ, s5_readauth, phb);
 	} else {
 		s5_sendconnect(phb, source);
@@ -491,5 +491,5 @@
 	if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
+		phb->func(phb->data, -1, B_EV_IO_READ);
 		g_free(phb->host);
 		g_free(phb);
@@ -513,11 +513,11 @@
 	if (write(source, buf, i) < i) {
 		close(source);
-		phb->func(phb->data, -1, GAIM_INPUT_READ);
-		g_free(phb->host);
-		g_free(phb);
-		return FALSE;
-	}
-
-	phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
+		phb->func(phb->data, -1, B_EV_IO_READ);
+		g_free(phb->host);
+		g_free(phb);
+		return FALSE;
+	}
+
+	phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread, phb);
 	
 	return FALSE;
Index: lib/ssl_bogus.c
===================================================================
--- lib/ssl_bogus.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/ssl_bogus.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -59,5 +59,5 @@
 b_input_condition ssl_getdirection( void *conn )
 {
-	return GAIM_INPUT_READ;
+	return B_EV_IO_READ;
 }
 
Index: lib/ssl_client.h
===================================================================
--- lib/ssl_client.h	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/ssl_client.h	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -71,5 +71,5 @@
 G_MODULE_EXPORT int ssl_getfd( void *conn );
 
-/* This function returns GAIM_INPUT_READ/WRITE. With SSL connections it's
+/* This function returns B_EV_IO_READ/WRITE. With SSL connections it's
    possible that something has to be read while actually were trying to
    write something (think about key exchange/refresh/etc). So when an
Index: lib/ssl_gnutls.c
===================================================================
--- lib/ssl_gnutls.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/ssl_gnutls.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -106,5 +106,5 @@
 	struct scd *conn = data;
 	
-	return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );
+	return ssl_connected( conn, conn->fd, B_EV_IO_WRITE );
 }
 
@@ -244,4 +244,4 @@
 {
 	return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
-	        GAIM_INPUT_WRITE : GAIM_INPUT_READ );
-}
+	        B_EV_IO_WRITE : B_EV_IO_READ );
+}
Index: lib/ssl_nss.c
===================================================================
--- lib/ssl_nss.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/ssl_nss.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -193,4 +193,4 @@
 {
 	/* Just in case someone calls us, let's return the most likely case: */
-	return GAIM_INPUT_READ;
+	return B_EV_IO_READ;
 }
Index: lib/ssl_openssl.c
===================================================================
--- lib/ssl_openssl.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/ssl_openssl.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -102,5 +102,5 @@
 	struct scd *conn = data;
 	
-	return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );
+	return ssl_connected( conn, conn->fd, B_EV_IO_WRITE );
 }
 
@@ -270,4 +270,4 @@
 b_input_condition ssl_getdirection( void *conn )
 {
-	return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );
-}
+	return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ );
+}
Index: lib/ssl_sspi.c
===================================================================
--- lib/ssl_sspi.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ lib/ssl_sspi.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -275,4 +275,4 @@
 GaimInputCondition ssl_getdirection( void *conn )
 {
-	return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */
-}
+	return B_EV_IO_WRITE; /* FIXME: or B_EV_IO_READ */
+}
Index: protocols/jabber/io.c
===================================================================
--- protocols/jabber/io.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ protocols/jabber/io.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -64,5 +64,5 @@
 		   most cases it probably won't be necessary.) */
 		if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 )
-			jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );
+			jd->w_inpa = b_input_add( jd->fd, B_EV_IO_WRITE, jabber_write_callback, ic );
 	}
 	else
@@ -529,5 +529,5 @@
 	
 	if( jd->r_inpa <= 0 )
-		jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
+		jd->r_inpa = b_input_add( jd->fd, B_EV_IO_READ, jabber_read_callback, ic );
 	
 	greet = g_strdup_printf( "<?xml version='1.0' ?>"
Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ protocols/msn/ns.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -75,5 +75,5 @@
 	if( msn_write( ic, s, strlen( s ) ) )
 	{
-		ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
+		ic->inpa = b_input_add( md->fd, B_EV_IO_READ, msn_ns_callback, ic );
 		imcb_log( ic, "Connected to server, waiting for reply" );
 	}
Index: protocols/msn/sb.c
===================================================================
--- protocols/msn/sb.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ protocols/msn/sb.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -309,5 +309,5 @@
 	
 	if( msn_sb_write( sb, buf, strlen( buf ) ) )
-		sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
+		sb->inp = b_input_add( sb->fd, B_EV_IO_READ, msn_sb_callback, sb );
 	else
 		debug( "Error %d while connecting to switchboard server", 2 );
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ protocols/oscar/oscar.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -291,5 +291,5 @@
 	odata = (struct oscar_data *)ic->proto_data;
 
-	if (condition & GAIM_INPUT_READ) {
+	if (condition & B_EV_IO_READ) {
 		if (aim_get_command(odata->sess, conn) >= 0) {
 			aim_rxdispatch(odata->sess);
@@ -363,5 +363,5 @@
 
 	aim_conn_completeconnect(sess, conn);
-	ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
+	ic->inpa = b_input_add(conn->fd, B_EV_IO_READ,
 			oscar_callback, conn);
 	
@@ -487,5 +487,5 @@
 
 	aim_conn_completeconnect(sess, bosconn);
-	ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
+	ic->inpa = b_input_add(bosconn->fd, B_EV_IO_READ,
 			oscar_callback, bosconn);
 	imcb_log(ic, _("Connection established, cookie sent"));
@@ -663,5 +663,5 @@
 	if (pos->modname)
 		g_free(pos->modname);
-	pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
+	pos->inpa = b_input_add(pos->fd, B_EV_IO_READ, damn_you, pos);
 	return FALSE;
 }
@@ -832,5 +832,5 @@
 
 	aim_conn_completeconnect(sess, tstconn);
-	odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
+	odata->cnpa = b_input_add(tstconn->fd, B_EV_IO_READ,
 					oscar_callback, tstconn);
 	
@@ -860,5 +860,5 @@
 
 	aim_conn_completeconnect(sess, tstconn);
-	odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
+	odata->paspa = b_input_add(tstconn->fd, B_EV_IO_READ,
 				oscar_callback, tstconn);
 	
@@ -896,5 +896,5 @@
 	aim_conn_completeconnect(sess, ccon->conn);
 	ccon->inpa = b_input_add(tstconn->fd,
-			GAIM_INPUT_READ,
+			B_EV_IO_READ,
 			oscar_callback, tstconn);
 	odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
Index: protocols/purple/purple.c
===================================================================
--- protocols/purple/purple.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ protocols/purple/purple.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -63,65 +63,20 @@
 }
 
-static void purple_glib_io_destroy(gpointer data)
-{
-	g_free(data);
-}
-
-static gboolean purple_glib_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data)
-{
-	PurpleGLibIOClosure *closure = data;
-	PurpleInputCondition purple_cond = 0;
-
-	if (condition & PURPLE_GLIB_READ_COND)
-		purple_cond |= PURPLE_INPUT_READ;
-	if (condition & PURPLE_GLIB_WRITE_COND)
-		purple_cond |= PURPLE_INPUT_WRITE;
-
-	closure->function(closure->data, g_io_channel_unix_get_fd(source),
-			  purple_cond);
-
-	return TRUE;
-}
-
-static guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function,
-							   gpointer data)
-{
-	PurpleGLibIOClosure *closure = g_new0(PurpleGLibIOClosure, 1);
-	GIOChannel *channel;
-	GIOCondition cond = 0;
-
-	closure->function = function;
-	closure->data = data;
-
-	if (condition & PURPLE_INPUT_READ)
-		cond |= PURPLE_GLIB_READ_COND;
-	if (condition & PURPLE_INPUT_WRITE)
-		cond |= PURPLE_GLIB_WRITE_COND;
-
-	channel = g_io_channel_unix_new(fd);
-	closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
-					      purple_glib_io_invoke, closure, purple_glib_io_destroy);
-
-	g_io_channel_unref(channel);
-	return closure->result;
+static guint prplcb_ev_timeout_add( guint interval, GSourceFunc func, gpointer udata )
+{
+	return b_timeout_add( interval, (b_event_handler) func, udata );
+}
+
+static guint prplcb_ev_input_add( int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer udata )
+{
+	return (guint) b_input_add( fd, cond, (b_event_handler) func, udata );
 }
 
 static PurpleEventLoopUiOps glib_eventloops = 
 {
-	g_timeout_add,
-	g_source_remove,
-	glib_input_add,
-	g_source_remove,
-	NULL,
-#if GLIB_CHECK_VERSION(2,14,0)
-	g_timeout_add_seconds,
-#else
-	NULL,
-#endif
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL
+	prplcb_ev_timeout_add,
+	b_event_remove,
+	prplcb_ev_input_add,
+	b_event_remove,
 };
 
@@ -137,5 +92,5 @@
 	PurpleAccount *pa;
 	//PurpleSavedStatus *ps;
-	GList *i;
+	//GList *i;
 	
 	/* For now this is needed in the _connected() handlers if using
@@ -343,5 +298,5 @@
 	NULL,                      /* write_chat           */
 	prplcb_conv_im,            /* write_im             */
-	NULL, //null_write_conv,           /* write_conv           */
+	NULL,                      /* write_conv           */
 	NULL,                      /* chat_add_users       */
 	NULL,                      /* chat_rename_user     */
@@ -381,4 +336,11 @@
 {
 	GList *prots;
+	
+	if( B_EV_IO_READ != PURPLE_INPUT_READ ||
+	    B_EV_IO_WRITE != PURPLE_INPUT_WRITE )
+	{
+		/* FIXME FIXME FIXME FIXME FIXME :-) */
+		exit( 1 );
+	}
 	
 	purple_util_set_user_dir("/tmp");
Index: protocols/yahoo/yahoo.c
===================================================================
--- protocols/yahoo/yahoo.c	(revision 0cbef26bd1f82787a8107e92b14839a59187e0c2)
+++ protocols/yahoo/yahoo.c	(revision e046390da36e369c94af607fdedfe7b9f99d9e47)
@@ -682,5 +682,5 @@
 		
 		inp->d = d;
-		d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
+		d->tag = inp->h = b_input_add( fd, B_EV_IO_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
 	}
 	else if( cond == YAHOO_INPUT_WRITE )
@@ -693,5 +693,5 @@
 		
 		inp->d = d;
-		d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
+		d->tag = inp->h = b_input_add( fd, B_EV_IO_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
 	}
 	else
