Changeset b308cf9 for protocols/msn/sb.c
- Timestamp:
- 2010-06-05T23:21:02Z (15 years ago)
- Branches:
- master
- Children:
- 1fdb0a4
- Parents:
- 3ab1d31 (diff), e774815 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/sb.c
r3ab1d31 rb308cf9 180 180 i = strlen( buf ); 181 181 } 182 else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 ) 183 { 184 buf = g_strdup( SB_KEEPALIVE_HEADERS ); 185 i = strlen( buf ); 186 } 182 187 else 183 188 { … … 256 261 257 262 msn_msgq_purge( ic, &sb->msgq ); 263 msn_sb_stop_keepalives( sb ); 258 264 259 265 if( sb->key ) g_free( sb->key ); … … 315 321 316 322 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 317 sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );323 sb->inp = b_input_add( sb->fd, B_EV_IO_READ, msn_sb_callback, sb ); 318 324 else 319 325 debug( "Error %d while connecting to switchboard server", 2 ); … … 328 334 struct msn_data *md = ic->proto_data; 329 335 330 if( msn_handler( sb->handler ) == -1 ) 336 if( msn_handler( sb->handler ) != -1 ) 337 return TRUE; 338 339 if( sb->msgq != NULL ) 331 340 { 332 341 time_t now = time( NULL ); 342 char buf[1024]; 333 343 334 344 if( now - md->first_sb_failure > 600 ) … … 347 357 "There might be problems delivering your messages." ); 348 358 349 if( sb->msgq != NULL ) 350 { 351 char buf[1024]; 352 353 if( md->msgq == NULL ) 354 { 355 md->msgq = sb->msgq; 356 } 357 else 358 { 359 GSList *l; 360 361 for( l = md->msgq; l->next; l = l->next ); 362 l->next = sb->msgq; 363 } 364 sb->msgq = NULL; 365 366 debug( "Moved queued messages back to the main queue, creating a new switchboard to retry." ); 367 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 368 if( !msn_write( ic, buf, strlen( buf ) ) ) 369 return FALSE; 370 } 371 372 msn_sb_destroy( sb ); 373 374 return FALSE; 375 } 376 else 377 { 378 return TRUE; 379 } 359 if( md->msgq == NULL ) 360 { 361 md->msgq = sb->msgq; 362 } 363 else 364 { 365 GSList *l; 366 367 for( l = md->msgq; l->next; l = l->next ); 368 l->next = sb->msgq; 369 } 370 sb->msgq = NULL; 371 372 debug( "Moved queued messages back to the main queue, " 373 "creating a new switchboard to retry." ); 374 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 375 if( !msn_write( ic, buf, strlen( buf ) ) ) 376 return FALSE; 377 } 378 379 msn_sb_destroy( sb ); 380 return FALSE; 380 381 } 381 382 … … 477 478 478 479 sb->ready = 1; 480 481 msn_sb_start_keepalives( sb, FALSE ); 479 482 } 480 483 else if( strcmp( cmd[0], "CAL" ) == 0 ) … … 526 529 } 527 530 531 msn_sb_start_keepalives( sb, FALSE ); 532 528 533 return( st ); 529 534 } … … 587 592 if( sb->who ) 588 593 { 594 msn_sb_stop_keepalives( sb ); 595 589 596 /* This is a single-person chat, and the other person is leaving. */ 590 597 g_free( sb->who ); … … 749 756 return( 1 ); 750 757 } 758 759 static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond ) 760 { 761 struct msn_switchboard *sb = data; 762 return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE ); 763 } 764 765 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial ) 766 { 767 struct buddy *b; 768 769 if( sb && sb->who && sb->keepalive == 0 && 770 ( b = imcb_find_buddy( sb->ic, sb->who ) ) && !b->present && 771 set_getbool( &sb->ic->acc->set, "switchboard_keepalives" ) ) 772 { 773 if( initial ) 774 msn_sb_keepalive( sb, 0, 0 ); 775 776 sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb ); 777 } 778 } 779 780 void msn_sb_stop_keepalives( struct msn_switchboard *sb ) 781 { 782 if( sb && sb->keepalive > 0 ) 783 { 784 b_event_remove( sb->keepalive ); 785 sb->keepalive = 0; 786 } 787 }
Note: See TracChangeset
for help on using the changeset viewer.