diff options
| -rw-r--r-- | protocols/msn/msn.c | 24 | ||||
| -rw-r--r-- | protocols/msn/msn.h | 3 | ||||
| -rw-r--r-- | protocols/msn/ns.c | 4 | ||||
| -rw-r--r-- | protocols/msn/sb.c | 21 | 
4 files changed, 44 insertions, 8 deletions
| diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 59adec62..8e10e202 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -190,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 );  } diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h index 4d2d0fdd..ed6db6f0 100644 --- a/protocols/msn/msn.h +++ b/protocols/msn/msn.h @@ -64,6 +64,9 @@  #define MSN_SB_NEW         -24062002 +#define MSN_CAP1        0xC000 +#define MSN_CAP2        0x0000 +  #define MSN_MESSAGE_HEADERS "MIME-Version: 1.0\r\n" \                              "Content-Type: text/plain; charset=UTF-8\r\n" \                              "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \ diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index b613b557..f8f18c80 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -573,8 +573,8 @@ static int msn_ns_command( struct msn_handler_data *handler, char **cmd, int num  	else if( strcmp( cmd[0], "UBX" ) == 0 )  	{  		/* Status message. */ -		if( num_parts >= 4 ) -			handler->msglen = atoi( cmd[3] ); +		if( num_parts >= 3 ) +			handler->msglen = atoi( cmd[2] );  	}  	else if( strcmp( cmd[0], "NOT" ) == 0 )  	{ diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index 14465c67..c8e97433 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -307,6 +307,7 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )  {  	struct msn_switchboard *sb = data;  	struct im_connection *ic; +	struct msn_data *md;  	char buf[1024];  	/* Are we still alive? */ @@ -314,6 +315,7 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )  		return FALSE;  	ic = sb->ic; +	md = ic->proto_data;  	if( source != sb->fd )  	{ @@ -331,9 +333,9 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )  	sb->handler->exec_message = msn_sb_message;  	if( sb->session == MSN_SB_NEW ) -		g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->acc->user, sb->key ); +		g_snprintf( buf, sizeof( buf ), "USR %d %s;{%s} %s\r\n", ++sb->trId, ic->acc->user, md->uuid, sb->key );  	else -		g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->acc->user, sb->key, sb->session ); +		g_snprintf( buf, sizeof( buf ), "ANS %d %s;{%s} %s %d\r\n", ++sb->trId, ic->acc->user, md->uuid, sb->key, sb->session );  	if( msn_sb_write( sb, "%s", buf ) )  		sb->inp = b_input_add( sb->fd, B_EV_IO_READ, msn_sb_callback, sb ); @@ -461,7 +463,12 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num  				sb->who = NULL;  			} -			imcb_chat_add_buddy( sb->chat, cmd[4] ); +			/* For as much as I understand this MPOP stuff now, a +			   switchboard has two (or more) roster entries per +			   participant. One "bare JID" and one JID;UUID. Ignore +			   the latter. */ +			if( !strchr( cmd[4], ';' ) ) +				imcb_chat_add_buddy( sb->chat, cmd[4] );  			if( num == tot )  			{ @@ -506,6 +513,10 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num  			return( 0 );  		} +		/* See IRO above. Handle "bare JIDs" only. */ +		if( strchr( cmd[1], ';' ) ) +			return 1; +		  		if( sb->who && g_strcasecmp( cmd[1], sb->who ) == 0 )  		{  			/* The user we wanted to talk to is finally there, let's send the queued messages then. */ @@ -540,6 +551,10 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num  			return( st );  		} +		else if( strcmp( cmd[1], ic->acc->user ) == 0 ) +		{ +			/* Well, gee thanks. Thanks for letting me know I've arrived.. */ +		}  		else if( sb->who )  		{  			debug( "Converting chat with %s to a groupchat because %s joined the session.", sb->who, cmd[1] ); | 
