aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn/msn.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-07 18:41:45 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-07 18:41:45 +0000
commitc32f492758759c04d8b6239a7862648c9d32c4d8 (patch)
tree628612ec0d2c431519a0a3741df7e4c6609db7f1 /protocols/msn/msn.c
parent1c2eaa3c99a2e7fbe264b06e559f3d709b9a080d (diff)
parent0e99548ba9c6ec9c78367e05b676dab90b5261a4 (diff)
Merging in improved away/status message code.
Diffstat (limited to 'protocols/msn/msn.c')
-rw-r--r--protocols/msn/msn.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 046b2772..e12fb3a9 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -138,8 +138,9 @@ static GList *msn_away_states( struct im_connection *ic )
int i;
if( l == NULL )
- for( i = 0; msn_away_state_list[i].number > -1; i ++ )
- l = g_list_append( l, (void*) msn_away_state_list[i].name );
+ for( i = 0; *msn_away_state_list[i].code; i ++ )
+ if( *msn_away_state_list[i].name )
+ l = g_list_append( l, (void*) msn_away_state_list[i].name );
return l;
}
@@ -148,17 +149,14 @@ static void msn_set_away( struct im_connection *ic, char *state, char *message )
{
char buf[1024];
struct msn_data *md = ic->proto_data;
- const struct msn_away_state *st;
- if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 )
- st = msn_away_state_by_name( "Away" );
+ if( state )
+ md->away_state = msn_away_state_by_name( state ) ? :
+ msn_away_state_list + 1;
else
- st = msn_away_state_by_name( state );
+ md->away_state = msn_away_state_list;
- if( !st ) st = msn_away_state_list;
- md->away_state = st;
-
- g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code );
+ g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code );
msn_write( ic, buf, strlen( buf ) );
}