aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn/msn.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-09-02 10:15:44 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-09-02 10:15:44 +0100
commit64768d4ec0c3ad473573c3f3c34871e0081b4e59 (patch)
tree5cde705bcd282cec322da9e82c9b0e26f16387dc /protocols/msn/msn.c
parent02bb9db2edd535036e030e004a58ed1459c15bb8 (diff)
Replace msn*write functions with saner versions that accept format strings.
Also preparing for additional temporary NS connections (auth token renewal).
Diffstat (limited to 'protocols/msn/msn.c')
-rw-r--r--protocols/msn/msn.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 4b79cc26..f37b802e 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -153,8 +153,7 @@ static int msn_buddy_msg( struct im_connection *ic, char *who, char *message, in
#ifdef DEBUG
if( strcmp( who, "raw" ) == 0 )
{
- msn_write( ic, message, strlen( message ) );
- msn_write( ic, "\r\n", 2 );
+ msn_ns_write( ic, -1, "%s\r\n", message );
}
else
#endif
@@ -192,7 +191,6 @@ static GList *msn_away_states( struct im_connection *ic )
static void msn_set_away( struct im_connection *ic, char *state, char *message )
{
- char buf[1024];
char *uux;
struct msn_data *md = ic->proto_data;
@@ -201,15 +199,13 @@ 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;
- g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code );
- if( !msn_write( ic, buf, strlen( buf ) ) )
+ if( !msn_ns_write( ic, -1, "CHG %d %s\r\n", ++md->trId, md->away_state->code ) )
return;
uux = g_markup_printf_escaped( "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia>"
"</Data>", message ? message : "" );
- g_snprintf( buf, sizeof( buf ), "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux );
- if( !msn_write( ic, buf, strlen( buf ) ) )
- return;
+ msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux );
+ g_free( uux );
}
static void msn_get_info(struct im_connection *ic, char *who)
@@ -289,7 +285,7 @@ static struct groupchat *msn_chat_with( struct im_connection *ic, char *who )
static void msn_keepalive( struct im_connection *ic )
{
- msn_write( ic, "PNG\r\n", strlen( "PNG\r\n" ) );
+ msn_ns_write( ic, -1, "PNG\r\n" );
}
static void msn_add_permit( struct im_connection *ic, char *who )