Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision 84b045d409f1e8da6d8bf379c6fef7236dcd9bcd)
+++ protocols/nogaim.c	(revision 6bbb939e953bbe1ca9ed3101a1569abe4521f543)
@@ -187,5 +187,5 @@
 
 	if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
-	    ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
+	    ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
 		strip_html( text );
 	
@@ -494,10 +494,10 @@
 /* server.c */                    
 
-void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
+void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
 {
 	user_t *u;
 	int oa, oo;
 	
-	u = user_findhandle( ic, handle );
+	u = user_findhandle( ic, (char*) handle );
 	
 	if( !u )
@@ -505,6 +505,6 @@
 		if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 )
 		{
-			add_buddy( ic, NULL, handle, NULL );
-			u = user_findhandle( ic, handle );
+			add_buddy( ic, NULL, (char*) handle, NULL );
+			u = user_findhandle( ic, (char*) handle );
 		}
 		else
@@ -512,12 +512,11 @@
 			if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )
 			{
-				imcb_log( ic, "serv_got_update() for handle %s:", handle );
-				imcb_log( ic, "loggedin = %d, type = %d", loggedin, type );
+				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" );
 			}
 			
 			return;
 		}
-		/* Why did we have this here....
-		return; */
 	}
 	
@@ -531,10 +530,10 @@
 	}
 	
-	if( loggedin && !u->online )
+	if( ( flags & OPT_LOGGED_IN ) && !u->online )
 	{
 		irc_spawn( ic->irc, u );
 		u->online = 1;
 	}
-	else if( !loggedin && u->online )
+	else if( !( flags & OPT_LOGGED_IN ) && u->online )
 	{
 		struct groupchat *c;
@@ -545,17 +544,27 @@
 		/* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */
 		for( c = ic->conversations; c; c = c->next )
-			remove_chat_buddy_silent( c, handle );
-	}
-	
-	if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "oscar" ) == 0 || strcmp( ic->acc->prpl->name, "icq" ) == 0 ) )
-	{
-		u->away = g_strdup( "Away" );
-	}
-	else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )
-	{
-		u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) );
-	}
-	else
-		u->away = NULL;
+			remove_chat_buddy_silent( c, (char*) 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 waste_any_state_information_for_now(); */
 	
 	/* LISPy... */
@@ -612,5 +621,5 @@
 	
 	if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
-	    ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
+	    ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
 		strip_html( msg );
 
@@ -718,5 +727,5 @@
 	
 	if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
-	    ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
+	    ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
 		strip_html( msg );
 	
@@ -925,5 +934,5 @@
 	int st;
 	
-	if( ( ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+	if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
 	{
 		buf = escape_html( msg );
@@ -941,5 +950,5 @@
 	char *buf = NULL;
 	
-	if( ( c->ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+	if( ( c->ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
 	{
 		buf = escape_html( msg );
