Index: protocols/bee.h
===================================================================
--- protocols/bee.h	(revision 231b08b07a2807881da1327408e33855370b7b95)
+++ protocols/bee.h	(revision f012a9f0bb363cfcbdb6f2d563254ffba26b9fc8)
@@ -69,4 +69,5 @@
 	gboolean (*user_free)( bee_t *bee, struct bee_user *bu );
 	gboolean (*user_status)( bee_t *bee, struct bee_user *bu, struct bee_user *old );
+	gboolean (*user_msg)( bee_t *bee, bee_user_t *bu, const char *msg, time_t sent_at );
 } bee_ui_funcs_t;
 
Index: protocols/bee_user.c
===================================================================
--- protocols/bee_user.c	(revision 231b08b07a2807881da1327408e33855370b7b95)
+++ protocols/bee_user.c	(revision f012a9f0bb363cfcbdb6f2d563254ffba26b9fc8)
@@ -116,9 +116,9 @@
 		else
 		{
-			if( set_getbool( &ic->bee->set, "debug" ) || g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
+			if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "ignore" ) != 0 )
 			{
-				imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
-				imcb_log( ic, "flags = %d, state = %s, message = %s", flags,
-				          state ? state : "NULL", message ? message : "NULL" );
+				imcb_log( ic, "imcb_buddy_status() for unknown handle %s:\n"
+				              "flags = %d, state = %s, message = %s", handle, flags,
+				              state ? state : "NULL", message ? message : "NULL" );
 			}
 			
@@ -142,52 +142,4 @@
 	g_free( old );
 #if 0	
-	oa = u->away != NULL;
-	oo = u->online;
-	
-	g_free( u->away );
-	g_free( u->status_msg );
-	u->away = u->status_msg = NULL;
-	
-	if( ( flags & OPT_LOGGED_IN ) && !u->online )
-	{
-		irc_spawn( ic->irc, u );
-		u->online = 1;
-	}
-	else if( !( flags & OPT_LOGGED_IN ) && u->online )
-	{
-		struct groupchat *c;
-		
-		irc_kill( ic->irc, u );
-		u->online = 0;
-		
-		/* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
-		for( c = ic->groupchats; c; c = c->next )
-			remove_chat_buddy_silent( c, handle );
-	}
-	
-	if( flags & OPT_AWAY )
-	{
-		if( state && message )
-		{
-			u->away = g_strdup_printf( "%s (%s)", state, message );
-		}
-		else if( state )
-		{
-			u->away = g_strdup( state );
-		}
-		else if( message )
-		{
-			u->away = g_strdup( message );
-		}
-		else
-		{
-			u->away = g_strdup( "Away" );
-		}
-	}
-	else
-	{
-		u->status_msg = g_strdup( message );
-	}
-	
 	/* LISPy... */
 	if( ( set_getbool( &ic->bee->set, "away_devoice" ) ) &&		/* Don't do a thing when user doesn't want it */
@@ -216,12 +168,11 @@
 void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
 {
-#if 0
 	bee_t *bee = ic->bee;
 	char *wrapped;
-	user_t *u;
+	bee_user_t *bu;
 	
-	u = user_findhandle( ic, handle );
+	bu = bee_user_by_handle( bee, ic, handle );
 	
-	if( !u )
+	if( !bu )
 	{
 		char *h = set_getstr( &bee->set, "handle_unknown" );
@@ -229,29 +180,9 @@
 		if( g_strcasecmp( h, "ignore" ) == 0 )
 		{
-			if( set_getbool( &bee->set, "debug" ) )
-				imcb_log( ic, "Ignoring message from unknown handle %s", handle );
-			
 			return;
 		}
 		else if( g_strncasecmp( h, "add", 3 ) == 0 )
 		{
-			int private = set_getbool( &bee->set, "private" );
-			
-			if( h[3] )
-			{
-				if( g_strcasecmp( h + 3, "_private" ) == 0 )
-					private = 1;
-				else if( g_strcasecmp( h + 3, "_channel" ) == 0 )
-					private = 0;
-			}
-			
-			imcb_add_buddy( ic, handle, NULL );
-			u = user_findhandle( ic, handle );
-			u->is_private = private;
-		}
-		else
-		{
-			imcb_log( ic, "Message from unknown handle %s:", handle );
-			u = user_find( irc, irc->mynick );
+			bu = bee_user_new( bee, ic, handle );
 		}
 	}
@@ -260,8 +191,8 @@
 	    ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->bee->set, "strip_html" ) ) )
 		strip_html( msg );
-
-	wrapped = word_wrap( msg, 425 );
-	irc_msgfrom( irc, u->nick, wrapped );
-	g_free( wrapped );
-#endif
+	
+	if( bee->ui->user_msg && bu )
+		bee->ui->user_msg( bee, bu, msg, sent_at );
+	else
+		imcb_log( ic, "Message from unknown handle %s:\n%s", handle, msg );
 }
