Index: irc_commands.c
===================================================================
--- irc_commands.c	(revision 573dab069d2c35910b3cdede3374a5749cb20a89)
+++ irc_commands.c	(revision 81186cab101fa8c2f82137014d0b3c060b658cb0)
@@ -352,5 +352,4 @@
 
 #if 0
-//#if 0
 static void irc_cmd_oper( irc_t *irc, char **cmd )
 {
@@ -524,38 +523,35 @@
 	}
 }
+#endif
 
 static void irc_cmd_away( irc_t *irc, char **cmd )
 {
-	user_t *u = user_find( irc, irc->nick );
-	char *away = cmd[1];
-	
-	if( !u ) return;
-	
-	if( away && *away )
-	{
+	char *set;
+	
+	if( cmd[1] && *cmd[1] )
+	{
+		char away[strlen(cmd[1])+1];
 		int i, j;
 		
 		/* Copy away string, but skip control chars. Mainly because
 		   Jabber really doesn't like them. */
-		u->away = g_malloc( strlen( away ) + 1 );
-		for( i = j = 0; away[i]; i ++ )
-			if( ( u->away[j] = away[i] ) >= ' ' )
+		for( i = j = 0; cmd[1][i]; i ++ )
+			if( ( away[j] = cmd[1][i] ) >= ' ' )
 				j ++;
-		u->away[j] = 0;
-		
-		irc_send_num( irc, 306, ":You're now away: %s", u->away );
-		/* irc_umode_set( irc, irc->myhost, "+a" ); */
-	}
-	else
-	{
-		if( u->away ) g_free( u->away );
-		u->away = NULL;
-		/* irc_umode_set( irc, irc->myhost, "-a" ); */
+		away[j] = '\0';
+		
+		irc_send_num( irc, 306, ":You're now away: %s", away );
+		set = away;
+	}
+	else
+	{
 		irc_send_num( irc, 305, ":Welcome back" );
-	}
-	
-	set_setstr( &irc->set, "away", u->away );
-}
-
+		set = NULL;
+	}
+	
+	set_setstr( &irc->b->set, "away", set );
+}
+
+#if 0
 static void irc_cmd_version( irc_t *irc, char **cmd )
 {
@@ -613,4 +609,5 @@
 	{ "nickserv",    1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },
 	{ "ns",          1, irc_cmd_nickserv,    IRC_CMD_LOGGED_IN },
+	{ "away",        0, irc_cmd_away,        IRC_CMD_LOGGED_IN },
 #if 0
 	{ "oper",        2, irc_cmd_oper,        IRC_CMD_LOGGED_IN },
@@ -621,5 +618,4 @@
 	{ "watch",       1, irc_cmd_watch,       IRC_CMD_LOGGED_IN },
 	{ "topic",       1, irc_cmd_topic,       IRC_CMD_LOGGED_IN },
-	{ "away",        0, irc_cmd_away,        IRC_CMD_LOGGED_IN },
 	{ "version",     0, irc_cmd_version,     IRC_CMD_LOGGED_IN },
 	{ "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN },
Index: protocols/bee.c
===================================================================
--- protocols/bee.c	(revision 573dab069d2c35910b3cdede3374a5749cb20a89)
+++ protocols/bee.c	(revision 81186cab101fa8c2f82137014d0b3c060b658cb0)
@@ -1,3 +1,31 @@
+  /********************************************************************\
+  * BitlBee -- An IRC to other IM-networks gateway                     *
+  *                                                                    *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
+  \********************************************************************/
+
+/* Some IM-core stuff                                                   */
+
+/*
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License with
+  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
+  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+  Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#define BITLBEE_CORE
 #include "bitlbee.h"
+
+static char *set_eval_away_status( set_t *set, char *value );
 
 bee_t *bee_new()
@@ -6,5 +34,5 @@
 	set_t *s;
 	
-	s = set_add( &b->set, "away", NULL, NULL/*set_eval_away_status*/, b );
+	s = set_add( &b->set, "away", NULL, set_eval_away_status, b );
 	s->flags |= SET_NULL_OK;
 	s = set_add( &b->set, "auto_connect", "true", set_eval_bool, b );
@@ -15,5 +43,5 @@
 	s->flags |= SET_NULL_OK;
 	s = set_add( &b->set, "save_on_quit", "true", set_eval_bool, b );
-	s = set_add( &b->set, "status", NULL, NULL/*set_eval_away_status*/, b );
+	s = set_add( &b->set, "status", NULL, set_eval_away_status, b );
 	s->flags |= SET_NULL_OK;
 	s = set_add( &b->set, "strip_html", "true", NULL, b );
@@ -46,2 +74,21 @@
 	g_free( b );
 }
+
+static char *set_eval_away_status( set_t *set, char *value )
+{
+	bee_t *bee = set->data;
+	account_t *a;
+	
+	g_free( set->value );
+	set->value = g_strdup( value );
+	
+	for( a = bee->accounts; a; a = a->next )
+	{
+		struct im_connection *ic = a->ic;
+		
+		if( ic && ic->flags & OPT_LOGGED_IN )
+			imc_away_send_update( ic );
+	}
+	
+	return value;
+}
