aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn/ns.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-07 18:43:23 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-07 18:43:23 +0000
commitfb020ac61b1e457de7a44492bb05a84515828ac7 (patch)
tree5dfdcae592d25251c11068cec8e8b1186de865b0 /protocols/msn/ns.c
parente08e53c9398700309000c6e6b7ff895185d567a9 (diff)
parentc32f492758759c04d8b6239a7862648c9d32c4d8 (diff)
Merging in mainline, including improved away/status stuff.
Diffstat (limited to 'protocols/msn/ns.c')
-rw-r--r--protocols/msn/ns.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 6928186a..b2b9cf81 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -419,11 +419,12 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( !st )
{
/* FIXME: Warn/Bomb about unknown away state? */
- st = msn_away_state_list;
+ st = msn_away_state_list + 1;
}
- imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN |
- ( st->number ? OPT_AWAY : 0 ), st->name, NULL );
+ imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN |
+ ( st != msn_away_state_list ? OPT_AWAY : 0 ),
+ st->name, NULL );
}
else if( strcmp( cmd[0], "FLN" ) == 0 )
{
@@ -448,11 +449,12 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( !st )
{
/* FIXME: Warn/Bomb about unknown away state? */
- st = msn_away_state_list;
+ st = msn_away_state_list + 1;
}
- imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN |
- ( st->number ? OPT_AWAY : 0 ), st->name, NULL );
+ imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN |
+ ( st != msn_away_state_list ? OPT_AWAY : 0 ),
+ st->name, NULL );
}
else if( strcmp( cmd[0], "RNG" ) == 0 )
{
@@ -662,8 +664,8 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int
imcb_log( ic, "The server is going down for maintenance in %s minutes.", arg1 );
}
- if( arg1 ) g_free( arg1 );
- if( mtype ) g_free( mtype );
+ g_free( arg1 );
+ g_free( mtype );
}
else if( g_strncasecmp( ct, "text/x-msmsgsprofile", 20 ) == 0 )
{
@@ -671,25 +673,30 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int
}
else if( g_strncasecmp( ct, "text/x-msmsgsinitialemailnotification", 37 ) == 0 )
{
- char *inbox = msn_findheader( body, "Inbox-Unread:", blen );
- char *folders = msn_findheader( body, "Folders-Unread:", blen );
-
- if( inbox && folders && set_getbool( &ic->acc->set, "mail_notifications" ) )
+ if( set_getbool( &ic->acc->set, "mail_notifications" ) )
{
- imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
+ char *inbox = msn_findheader( body, "Inbox-Unread:", blen );
+ char *folders = msn_findheader( body, "Folders-Unread:", blen );
+
+ if( inbox && folders )
+ imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
+
+ g_free( inbox );
+ g_free( folders );
}
-
- g_free( inbox );
- g_free( folders );
}
else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 )
{
- char *from = msn_findheader( body, "From-Addr:", blen );
- char *fromname = msn_findheader( body, "From:", blen );
-
- if( from && fromname && set_getbool( &ic->acc->set, "mail_notifications" ) )
+ if( set_getbool( &ic->acc->set, "mail_notifications" ) )
{
- imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from );
+ char *from = msn_findheader( body, "From-Addr:", blen );
+ char *fromname = msn_findheader( body, "From:", blen );
+
+ if( from && fromname )
+ imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from );
+
+ g_free( from );
+ g_free( fromname );
}
}
else if( g_strncasecmp( ct, "text/x-msmsgsactivemailnotification", 35 ) == 0 )