Changeset bb839e8 for protocols/msn
- Timestamp:
- 2010-04-10T01:05:39Z (15 years ago)
- Branches:
- master
- Children:
- efbc154
- Parents:
- 9bf2481
- Location:
- protocols/msn
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
r9bf2481 rbb839e8 185 185 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); 186 186 int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m ); 187 gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond ); 187 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial ); 188 void msn_sb_stop_keepalives( struct msn_switchboard *sb ); 188 189 189 190 #endif //_MSN_H -
protocols/msn/ns.c
r9bf2481 rbb839e8 436 436 else if( strcmp( cmd[0], "FLN" ) == 0 ) 437 437 { 438 struct msn_switchboard *sb;439 440 438 if( cmd[1] == NULL ) 441 439 return 1; … … 443 441 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 444 442 445 if( ( sb = msn_sb_by_handle( ic, cmd[1] ) ) && 446 set_getbool( &ic->acc->set, "switchboard_keepalives" ) && 447 sb->keepalive == 0 ) 448 { 449 msn_sb_keepalive( sb, 0, 0 ); 450 sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb ); 451 } 443 msn_sb_start_keepalives( msn_sb_by_handle( ic, cmd[1] ), TRUE ); 452 444 } 453 445 else if( strcmp( cmd[0], "NLN" ) == 0 ) 454 446 { 455 447 const struct msn_away_state *st; 456 struct msn_switchboard *sb;457 448 458 449 if( num_parts != 5 ) … … 477 468 st->name, NULL ); 478 469 479 if( ( sb = msn_sb_by_handle( ic, cmd[1] ) ) && sb->keepalive > 0 ) 480 { 481 b_event_remove( sb->keepalive ); 482 sb->keepalive = 0; 483 } 470 msn_sb_stop_keepalives( msn_sb_by_handle( ic, cmd[2] ) ); 484 471 } 485 472 else if( strcmp( cmd[0], "RNG" ) == 0 ) -
protocols/msn/sb.c
r9bf2481 rbb839e8 255 255 256 256 msn_msgq_purge( ic, &sb->msgq ); 257 msn_sb_stop_keepalives( sb ); 257 258 258 259 if( sb->key ) g_free( sb->key ); … … 476 477 477 478 sb->ready = 1; 479 480 msn_sb_start_keepalives( sb, FALSE ); 478 481 } 479 482 else if( strcmp( cmd[0], "CAL" ) == 0 ) … … 525 528 } 526 529 530 msn_sb_start_keepalives( sb, FALSE ); 531 527 532 return( st ); 528 533 } … … 586 591 if( sb->who ) 587 592 { 593 msn_sb_stop_keepalives( sb ); 594 588 595 /* This is a single-person chat, and the other person is leaving. */ 589 596 g_free( sb->who ); … … 770 777 } 771 778 772 gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond )779 static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond ) 773 780 { 774 781 struct msn_switchboard *sb = data; 775 782 return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE ); 776 783 } 784 785 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial ) 786 { 787 struct buddy *b; 788 789 if( sb && sb->who && sb->keepalive == 0 && 790 ( b = imcb_find_buddy( sb->ic, sb->who ) ) && !b->present && 791 set_getbool( &sb->ic->acc->set, "switchboard_keepalives" ) ) 792 { 793 if( initial ) 794 msn_sb_keepalive( sb, 0, 0 ); 795 796 sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb ); 797 } 798 } 799 800 void msn_sb_stop_keepalives( struct msn_switchboard *sb ) 801 { 802 if( sb && sb->keepalive > 0 ) 803 { 804 b_event_remove( sb->keepalive ); 805 sb->keepalive = 0; 806 } 807 }
Note: See TracChangeset
for help on using the changeset viewer.