aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn/msn.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/msn/msn.c')
-rw-r--r--protocols/msn/msn.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 03f28422..8e10e202 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -1,7 +1,7 @@
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
- * Copyright 2002-2010 Wilmer van der Gaast and others *
+ * Copyright 2002-2012 Wilmer van der Gaast and others *
\********************************************************************/
/* MSN module - Main file; functions to be called from BitlBee */
@@ -97,6 +97,7 @@ static void msn_logout( struct im_connection *ic )
g_free( md->tokens[i] );
g_free( md->lock_key );
g_free( md->pp_policy );
+ g_free( md->uuid );
while( md->groups )
{
@@ -189,11 +190,29 @@ static void msn_set_away( struct im_connection *ic, char *state, char *message )
else if( ( md->away_state = msn_away_state_by_name( state ) ) == NULL )
md->away_state = msn_away_state_list + 1;
- if( !msn_ns_write( ic, -1, "CHG %d %s\r\n", ++md->trId, md->away_state->code ) )
+ if( !msn_ns_write( ic, -1, "CHG %d %s %d:%02d\r\n", ++md->trId, md->away_state->code, MSN_CAP1, MSN_CAP2 ) )
return;
- uux = g_markup_printf_escaped( "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia>"
- "</Data>", message ? message : "" );
+ uux = g_markup_printf_escaped( "<EndpointData><Capabilities>%d:%02d"
+ "</Capabilities></EndpointData>",
+ MSN_CAP1, MSN_CAP2 );
+ msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux );
+ g_free( uux );
+
+ uux = g_markup_printf_escaped( "<PrivateEndpointData><EpName>%s</EpName>"
+ "<Idle>%s</Idle><ClientType>%d</ClientType>"
+ "<State>%s</State></PrivateEndpointData>",
+ md->uuid,
+ strcmp( md->away_state->code, "IDL" ) ? "false" : "true",
+ 1, /* ? */
+ md->away_state->code );
+ msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux );
+ g_free( uux );
+
+ uux = g_markup_printf_escaped( "<Data><DDP></DDP><PSM>%s</PSM>"
+ "<CurrentMedia></CurrentMedia>"
+ "<MachineGuid>%s</MachineGuid></Data>",
+ message ? message : "", md->uuid );
msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux );
g_free( uux );
}
@@ -231,13 +250,9 @@ static void msn_chat_msg( struct groupchat *c, char *message, int flags )
static void msn_chat_invite( struct groupchat *c, char *who, char *message )
{
struct msn_switchboard *sb = msn_sb_by_chat( c );
- char buf[1024];
if( sb )
- {
- g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who );
- msn_sb_write( sb, buf, strlen( buf ) );
- }
+ msn_sb_write( sb, "CAL %d %s\r\n", ++sb->trId, who );
}
static void msn_chat_leave( struct groupchat *c )
@@ -245,7 +260,7 @@ static void msn_chat_leave( struct groupchat *c )
struct msn_switchboard *sb = msn_sb_by_chat( c );
if( sb )
- msn_sb_write( sb, "OUT\r\n", 5 );
+ msn_sb_write( sb, "OUT\r\n" );
}
static struct groupchat *msn_chat_with( struct im_connection *ic, char *who )