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
