Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision d1ad6f0973bda799bdf21e36f20dc58f7bb1bf08)
+++ protocols/jabber/jabber.c	(revision 840bba81bc4ab7ce37aeeea5f32091684b19e5b8)
@@ -80,4 +80,6 @@
 	s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc );
 	s->flags |= ACC_SET_OFFLINE_ONLY;
+	
+	acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;
 }
 
@@ -377,9 +379,10 @@
 {
 	struct jabber_data *jd = ic->proto_data;
-	struct jabber_away_state *state;
-	
-	/* Save all this info. We need it, for example, when changing the priority setting. */
-	state = (void *) jabber_away_state_by_name( state_txt );
-	jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */
+	
+	/* state_txt == NULL -> Not away.
+	   Unknown state -> fall back to the first defined away state. */
+	jd->away_state = state_txt ? jabber_away_state_by_name( state_txt )
+	                 ? : jabber_away_state_list : NULL;
+	
 	g_free( jd->away_message );
 	jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL;
Index: protocols/jabber/jabber.h
===================================================================
--- protocols/jabber/jabber.h	(revision d1ad6f0973bda799bdf21e36f20dc58f7bb1bf08)
+++ protocols/jabber/jabber.h	(revision 840bba81bc4ab7ce37aeeea5f32091684b19e5b8)
@@ -84,5 +84,5 @@
 	/* After changing one of these two (or the priority setting), call
 	   presence_send_update() to inform the server about the changes. */
-	struct jabber_away_state *away_state;
+	const struct jabber_away_state *away_state;
 	char *away_message;
 	
Index: protocols/jabber/jabber_util.c
===================================================================
--- protocols/jabber/jabber_util.c	(revision d1ad6f0973bda799bdf21e36f20dc58f7bb1bf08)
+++ protocols/jabber/jabber_util.c	(revision 840bba81bc4ab7ce37aeeea5f32091684b19e5b8)
@@ -228,8 +228,7 @@
 {
 	{ "away",  "Away" },
-	{ "chat",  "Free for Chat" },
+	{ "chat",  "Free for Chat" },   /* WTF actually uses this? */
 	{ "dnd",   "Do not Disturb" },
 	{ "xa",    "Extended Away" },
-	{ "",      "Online" },
 	{ "",      NULL }
 };
@@ -238,4 +237,7 @@
 {
 	int i;
+	
+	if( code == NULL )
+		return NULL;
 	
 	for( i = 0; jabber_away_state_list[i].full_name; i ++ )
@@ -249,4 +251,7 @@
 {
 	int i;
+	
+	if( name == NULL )
+		return NULL;
 	
 	for( i = 0; jabber_away_state_list[i].full_name; i ++ )
Index: protocols/jabber/presence.c
===================================================================
--- protocols/jabber/presence.c	(revision d1ad6f0973bda799bdf21e36f20dc58f7bb1bf08)
+++ protocols/jabber/presence.c	(revision 840bba81bc4ab7ce37aeeea5f32091684b19e5b8)
@@ -190,11 +190,10 @@
 		int is_away = 0;
 
-		if( send_presence->away_state && !( *send_presence->away_state->code == 0 ||
-		    strcmp( send_presence->away_state->code, "chat" ) == 0 ) )
+		if( send_presence->away_state &&
+		    strcmp( send_presence->away_state->code, "chat" ) != 0 )
 			is_away = OPT_AWAY;
 
 		imcb_buddy_status( ic, send_presence->bare_jid, OPT_LOGGED_IN | is_away,
-		                   ( is_away && send_presence->away_state ) ?
-		                   send_presence->away_state->full_name : NULL,
+		                   is_away ? send_presence->away_state->full_name : NULL,
 		                   send_presence->away_message );
 	}
@@ -209,6 +208,4 @@
 	struct jabber_data *jd = ic->proto_data;
 	struct xt_node *node, *cap;
-	char *show = jd->away_state->code;
-	char *status = jd->away_message;
 	struct groupchat *c;
 	int st;
@@ -216,8 +213,8 @@
 	node = jabber_make_packet( "presence", NULL, NULL, NULL );
 	xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) );
-	if( show && *show )
-		xt_add_child( node, xt_new_node( "show", show, NULL ) );
-	if( status )
-		xt_add_child( node, xt_new_node( "status", status, NULL ) );
+	if( jd->away_state )
+		xt_add_child( node, xt_new_node( "show", jd->away_state->code, NULL ) );
+	if( jd->away_message )
+		xt_add_child( node, xt_new_node( "status", jd->away_message, NULL ) );
 	
 	/* This makes the packet slightly bigger, but clients interested in
