Changes in protocols/msn/sb.c [6048744:bd28e6a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/sb.c
r6048744 rbd28e6a 30 30 #include "md5.h" 31 31 32 static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond );32 static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ); 33 33 static int msn_sb_command( gpointer data, char **cmd, int num_parts ); 34 34 static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); … … 122 122 if( sb->ready ) 123 123 { 124 char cmd[1024], *buf;124 char *packet, *buf; 125 125 int i, j; 126 126 127 /* Build the message. Convert LF to CR-LF for normal messages. */ 127 128 if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 ) 128 129 { … … 142 143 { 143 144 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username ); 144 buf = g_new0( char, strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username ));145 buf = g_new0( char, i ); 145 146 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->gc->username ); 146 147 } 147 148 148 g_snprintf( cmd, sizeof( cmd ), "MSG %d N %d\r\n", ++sb->trId, i ); 149 if( msn_sb_write( sb, cmd, strlen( cmd ) ) && msn_sb_write( sb, buf, i ) ) 150 { 151 g_free( buf ); 149 /* Build the final packet (MSG command + the message). */ 150 packet = g_strdup_printf( "MSG %d N %d\r\n%s", ++sb->trId, i, buf ); 151 g_free( buf ); 152 if( msn_sb_write( sb, packet, strlen( packet ) ) ) 153 { 154 g_free( packet ); 152 155 return( 1 ); 153 156 } 154 157 else 155 158 { 156 g_free( buf);159 g_free( packet ); 157 160 return( 0 ); 158 161 } … … 237 240 } 238 241 239 if( sb->inp ) gaim_input_remove( sb->inp );242 if( sb->inp ) b_event_remove( sb->inp ); 240 243 closesocket( sb->fd ); 241 244 … … 245 248 } 246 249 247 void msn_sb_connected( gpointer data, gint source, GaimInputCondition cond )250 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ) 248 251 { 249 252 struct msn_switchboard *sb = data; … … 254 257 /* Are we still alive? */ 255 258 if( !g_slist_find( msn_switchboards, sb ) ) 256 return ;259 return FALSE; 257 260 258 261 gc = sb->gc; … … 263 266 debug( "ERROR %d while connecting to switchboard server", 1 ); 264 267 msn_sb_destroy( sb ); 265 return ;268 return FALSE; 266 269 } 267 270 … … 280 283 281 284 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 282 sb->inp = gaim_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );285 sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb ); 283 286 else 284 287 debug( "ERROR %d while connecting to switchboard server", 2 ); 285 } 286 287 static void msn_sb_callback( gpointer data, gint source, GaimInputCondition cond ) 288 289 return FALSE; 290 } 291 292 static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ) 288 293 { 289 294 struct msn_switchboard *sb = data; … … 293 298 debug( "ERROR: Switchboard died" ); 294 299 msn_sb_destroy( sb ); 295 } 300 301 return FALSE; 302 } 303 else 304 return TRUE; 296 305 } 297 306
Note: See TracChangeset
for help on using the changeset viewer.