Ignore:
Timestamp:
2006-08-25T12:34:36Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
695e392
Parents:
a36b030
Message:

Added msn_http_encode() so it can be used in msn_buddy_list_add() too.
Most likely fixes #198.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn_util.c

    ra36b030 r54794b8  
    5656        char buf[1024], *realname;
    5757       
    58         realname = g_new0( char, strlen( realname_ ) * 3 + 1 );
    59         strcpy( realname, realname_ );
    60         http_encode( realname );
     58        realname = msn_http_encode( realname_ );
    6159       
    6260        g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname );
     
    315313        return( 1 );
    316314}
     315
     316/* The difference between this function and the normal http_encode() function
     317   is that this one escapes every 7-bit ASCII character because this is said
     318   to avoid some lame server-side checks when setting a real-name. Also,
     319   non-ASCII characters are not escaped because MSN servers don't seem to
     320   appreciate that! */
     321char *msn_http_encode( const char *input )
     322{
     323        char *ret, *s;
     324        int i;
     325       
     326        ret = s = g_new0( char, strlen( input ) * 3 + 1 );
     327        for( i = 0; input[i]; i ++ )
     328                if( input[i] & 128 )
     329                {
     330                        *s = input[i];
     331                        s ++;
     332                }
     333                else
     334                {
     335                        g_snprintf( s, 4, "%%%02X", input[i] );
     336                        s += 3;
     337                }
     338       
     339        return ret;
     340}
Note: See TracChangeset for help on using the changeset viewer.