Changes in protocols/msn/sb.c [bb839e8:a830512]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/sb.c
rbb839e8 ra830512 168 168 169 169 /* Build the message. Convert LF to CR-LF for normal messages. */ 170 if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) == 0 ) 170 if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 ) 171 { 172 buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 + 1 ); 173 i = strlen( MSN_MESSAGE_HEADERS ); 174 175 strcpy( buf, MSN_MESSAGE_HEADERS ); 176 for( j = 0; text[j]; j ++ ) 177 { 178 if( text[j] == '\n' ) 179 buf[i++] = '\r'; 180 181 buf[i++] = text[j]; 182 } 183 } 184 else 171 185 { 172 186 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->acc->user ); 173 187 buf = g_new0( char, i ); 174 188 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user ); 175 }176 else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 )177 {178 buf = g_strdup( SB_KEEPALIVE_HEADERS );179 i = strlen( buf );180 }181 else182 {183 buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 + 1 );184 i = strlen( MSN_MESSAGE_HEADERS );185 186 strcpy( buf, MSN_MESSAGE_HEADERS );187 for( j = 0; text[j]; j ++ )188 {189 if( text[j] == '\n' )190 buf[i++] = '\r';191 192 buf[i++] = text[j];193 }194 189 } 195 190 … … 255 250 256 251 msn_msgq_purge( ic, &sb->msgq ); 257 msn_sb_stop_keepalives( sb );258 252 259 253 if( sb->key ) g_free( sb->key ); … … 477 471 478 472 sb->ready = 1; 479 480 msn_sb_start_keepalives( sb, FALSE );481 473 } 482 474 else if( strcmp( cmd[0], "CAL" ) == 0 ) … … 528 520 } 529 521 530 msn_sb_start_keepalives( sb, FALSE );531 532 522 return( st ); 533 523 } … … 591 581 if( sb->who ) 592 582 { 593 msn_sb_stop_keepalives( sb );594 595 583 /* This is a single-person chat, and the other person is leaving. */ 596 584 g_free( sb->who ); … … 776 764 return( 1 ); 777 765 } 778 779 static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond )780 {781 struct msn_switchboard *sb = data;782 return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE );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.