- Timestamp:
- 2010-04-09T23:16:38Z (15 years ago)
- Branches:
- master
- Children:
- bb839e8
- Parents:
- c4bc92a
- Location:
- protocols/msn
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
rc4bc92a r9bf2481 41 41 42 42 s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 43 44 s = set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 43 45 } 44 46 -
protocols/msn/msn.h
rc4bc92a r9bf2481 31 31 #define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r" 32 32 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r" 33 #define SB_KEEPALIVE_MESSAGE "\r\r\rDONT HANG UP ON ME!\r\r\r" 33 34 34 35 #ifdef DEBUG_MSN … … 53 54 "TypingUser: %s\r\n" \ 54 55 "\r\n\r\n" 56 57 #define SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \ 58 "Content-Type: text/x-ping\r\n" \ 59 "\r\n\r\n" 55 60 56 61 #define PROFILE_URL "http://members.msn.com/" … … 83 88 gint inp; 84 89 struct msn_handler_data *handler; 90 gint keepalive; 85 91 86 92 int trId; … … 179 185 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); 180 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 ); 181 188 182 189 #endif //_MSN_H -
protocols/msn/ns.c
rc4bc92a r9bf2481 436 436 else if( strcmp( cmd[0], "FLN" ) == 0 ) 437 437 { 438 if( cmd[1] ) 439 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 438 struct msn_switchboard *sb; 439 440 if( cmd[1] == NULL ) 441 return 1; 442 443 imcb_buddy_status( ic, cmd[1], 0, NULL, NULL ); 444 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 } 440 452 } 441 453 else if( strcmp( cmd[0], "NLN" ) == 0 ) 442 454 { 443 455 const struct msn_away_state *st; 456 struct msn_switchboard *sb; 444 457 445 458 if( num_parts != 5 ) … … 463 476 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 464 477 st->name, NULL ); 478 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 } 465 484 } 466 485 else if( strcmp( cmd[0], "RNG" ) == 0 ) -
protocols/msn/sb.c
rc4bc92a r9bf2481 168 168 169 169 /* Build the message. Convert LF to CR-LF for normal messages. */ 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 170 if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) == 0 ) 185 171 { 186 172 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->acc->user ); 187 173 buf = g_new0( char, i ); 188 174 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 else 182 { 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 } 189 194 } 190 195 … … 764 769 return( 1 ); 765 770 } 771 772 gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond ) 773 { 774 struct msn_switchboard *sb = data; 775 return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE ); 776 }
Note: See TracChangeset
for help on using the changeset viewer.