- Timestamp:
- 2012-09-16T17:40:44Z (12 years ago)
- Branches:
- master
- Children:
- e9caacd
- Parents:
- 080c43a
- Location:
- protocols/msn
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
r080c43a r79bb7e4 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-201 0Wilmer van der Gaast and others *4 * Copyright 2002-2012 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 253 253 struct msn_group *msn_group_by_id( struct im_connection *ic, const char *id ); 254 254 int msn_ns_set_display_name( struct im_connection *ic, const char *value ); 255 const char *msn_normalize_handle( const char *handle ); 255 256 256 257 /* tables.c */ … … 263 264 int msn_sb_write( struct msn_switchboard *sb, const char *fmt, ... ) G_GNUC_PRINTF( 2, 3 );; 264 265 struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session ); 265 struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, c har *handle );266 struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, const char *handle ); 266 267 struct msn_switchboard *msn_sb_by_chat( struct groupchat *c ); 267 268 struct msn_switchboard *msn_sb_spare( struct im_connection *ic ); -
protocols/msn/msn_util.c
r080c43a r79bb7e4 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-201 0Wilmer van der Gaast and others *4 * Copyright 2002-2012 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 537 537 return msn_ns_write( ic, -1, "PRP %d MFN %s\r\n", ++md->trId, fn ); 538 538 } 539 540 const char *msn_normalize_handle( const char *handle ) 541 { 542 if( strncmp( handle, "1:", 2 ) == 0 ) 543 return handle + 2; 544 else 545 return handle; 546 } -
protocols/msn/ns.c
r080c43a r79bb7e4 372 372 return st; 373 373 } 374 else if( strcmp( cmd[0], "ILN" ) == 0 )374 else if( strcmp( cmd[0], "ILN" ) == 0 || strcmp( cmd[0], "NLN" ) == 0 ) 375 375 { 376 376 const struct msn_away_state *st; 377 const char *handle; 378 int cap = 0; 377 379 378 380 if( num_parts < 6 ) … … 382 384 return( 0 ); 383 385 } 384 385 http_decode( cmd[5] ); 386 imcb_rename_buddy( ic, cmd[3], cmd[5] ); 387 388 st = msn_away_state_by_code( cmd[2] ); 386 /* ILN and NLN are more or less the same, except ILN has a trId 387 at the start, and NLN has a capability field at the end. 388 Does ILN still exist BTW? */ 389 if( cmd[0][1] == 'I' ) 390 cmd ++; 391 else 392 cap = atoi( cmd[4] ); 393 394 handle = msn_normalize_handle( cmd[2] ); 395 if( strcmp( handle, ic->acc->user ) == 0 ) 396 return 1; /* That's me! */ 397 398 http_decode( cmd[3] ); 399 imcb_rename_buddy( ic, handle, cmd[3] ); 400 401 st = msn_away_state_by_code( cmd[1] ); 389 402 if( !st ) 390 403 { … … 393 406 } 394 407 395 imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 396 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 397 st->name, NULL ); 398 } 399 else if( strcmp( cmd[0], "FLN" ) == 0 ) 400 { 401 if( cmd[1] == NULL ) 402 return 1; 403 404 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 405 406 msn_sb_start_keepalives( msn_sb_by_handle( ic, cmd[1] ), TRUE ); 407 } 408 else if( strcmp( cmd[0], "NLN" ) == 0 ) 409 { 410 const struct msn_away_state *st; 411 int cap; 412 413 if( num_parts < 6 ) 414 { 415 imcb_error( ic, "Syntax error" ); 416 imc_logout( ic, TRUE ); 417 return( 0 ); 418 } 419 420 http_decode( cmd[4] ); 421 cap = atoi( cmd[5] ); 422 imcb_rename_buddy( ic, cmd[2], cmd[4] ); 423 424 st = msn_away_state_by_code( cmd[1] ); 425 if( !st ) 426 { 427 /* FIXME: Warn/Bomb about unknown away state? */ 428 st = msn_away_state_list + 1; 429 } 430 431 imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 408 imcb_buddy_status( ic, handle, OPT_LOGGED_IN | 432 409 ( st != msn_away_state_list ? OPT_AWAY : 0 ) | 433 410 ( cap & 1 ? OPT_MOBILE : 0 ), 434 411 st->name, NULL ); 435 412 436 msn_sb_stop_keepalives( msn_sb_by_handle( ic, cmd[2] ) ); 413 msn_sb_stop_keepalives( msn_sb_by_handle( ic, handle ) ); 414 } 415 else if( strcmp( cmd[0], "FLN" ) == 0 ) 416 { 417 const char *handle; 418 419 if( cmd[1] == NULL ) 420 return 1; 421 422 handle = msn_normalize_handle( cmd[1] ); 423 imcb_buddy_status( ic, handle, 0, NULL, NULL ); 424 msn_sb_start_keepalives( msn_sb_by_handle( ic, handle ), TRUE ); 437 425 } 438 426 else if( strcmp( cmd[0], "RNG" ) == 0 ) … … 481 469 else 482 470 { 483 sb->who = g_strdup( cmd[5]);471 sb->who = g_strdup( msn_normalize_handle( cmd[5] ) ); 484 472 } 485 473 } … … 707 695 psm_text = psm->text; 708 696 709 imcb_buddy_status_msg( ic, cmd[1], psm_text );697 imcb_buddy_status_msg( ic, msn_normalize_handle( cmd[1] ), psm_text ); 710 698 xt_free_node( ubx ); 711 699 } -
protocols/msn/sb.c
r080c43a r79bb7e4 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-201 0Wilmer van der Gaast and others *4 * Copyright 2002-2012 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 122 122 } 123 123 124 struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, c har *handle )124 struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, const char *handle ) 125 125 { 126 126 struct msn_data *md = ic->proto_data;
Note: See TracChangeset
for help on using the changeset viewer.