Changeset bd28e6a for protocols/msn


Ignore:
Timestamp:
2006-10-24T10:40:28Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a3a3778
Parents:
6237ded
Message:

MSN message packets are now sent at once instead of separately. Probably
the MSN servers don't care, but it looks a bit prettier in wireshark. ;-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/sb.c

    r6237ded rbd28e6a  
    122122        if( sb->ready )
    123123        {
    124                 char cmd[1024], *buf;
     124                char *packet, *buf;
    125125                int i, j;
    126126               
     127                /* Build the message. Convert LF to CR-LF for normal messages. */
    127128                if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 )
    128129                {
     
    142143                {
    143144                        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 );
    145146                        i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->gc->username );
    146147                }
    147148               
    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 );
    152155                        return( 1 );
    153156                }
    154157                else
    155158                {
    156                         g_free( buf );
     159                        g_free( packet );
    157160                        return( 0 );
    158161                }
Note: See TracChangeset for help on using the changeset viewer.