Changeset 54794b8
- Timestamp:
- 2006-08-25T12:34:36Z (18 years ago)
- Branches:
- master
- Children:
- 695e392
- Parents:
- a36b030
- Location:
- protocols/msn
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
ra36b030 r54794b8 212 212 static void msn_set_info( struct gaim_connection *gc, char *info ) 213 213 { 214 int i; 215 char buf[1024], *fn, *s; 214 char buf[1024], *fn; 216 215 struct msn_data *md = gc->proto_data; 217 216 … … 222 221 } 223 222 224 /* Of course we could use http_encode() here, but when we encode 225 every character, the server is less likely to complain about the 226 chosen name. However, the MSN server doesn't seem to like escaped 227 non-ASCII chars, so we keep those unescaped. */ 228 s = fn = g_new0( char, strlen( info ) * 3 + 1 ); 229 for( i = 0; info[i]; i ++ ) 230 if( info[i] & 128 ) 231 { 232 *s = info[i]; 233 s ++; 234 } 235 else 236 { 237 g_snprintf( s, 4, "%%%02X", info[i] ); 238 s += 3; 239 } 223 fn = msn_http_encode( info ); 240 224 241 225 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn ); -
protocols/msn/msn.h
ra36b030 r54794b8 157 157 char **msn_linesplit( char *line ); 158 158 int msn_handler( struct msn_handler_data *h ); 159 char *msn_http_encode( const char *input ); 159 160 160 161 /* tables.c */ -
protocols/msn/msn_util.c
ra36b030 r54794b8 56 56 char buf[1024], *realname; 57 57 58 realname = g_new0( char, strlen( realname_ ) * 3 + 1 ); 59 strcpy( realname, realname_ ); 60 http_encode( realname ); 58 realname = msn_http_encode( realname_ ); 61 59 62 60 g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname ); … … 315 313 return( 1 ); 316 314 } 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! */ 321 char *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.