Changeset 0da65d5 for protocols/msn/sb.c
- Timestamp:
- 2007-03-31T05:40:45Z (17 years ago)
- Branches:
- master
- Children:
- aef4828
- Parents:
- fa29d093
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/sb.c
rfa29d093 r0da65d5 48 48 } 49 49 50 struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session )51 { 52 struct msn_data *md = gc->proto_data;50 struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session ) 51 { 52 struct msn_data *md = ic->proto_data; 53 53 struct msn_switchboard *sb = g_new0( struct msn_switchboard, 1 ); 54 54 … … 60 60 } 61 61 62 sb-> gc = gc;62 sb->ic = ic; 63 63 sb->key = g_strdup( key ); 64 64 sb->session = session; … … 70 70 } 71 71 72 struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle )73 { 74 struct msn_data *md = gc->proto_data;72 struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle ) 73 { 74 struct msn_data *md = ic->proto_data; 75 75 struct msn_switchboard *sb; 76 76 GSList *l; … … 86 86 } 87 87 88 struct msn_switchboard *msn_sb_by_chat( struct conversation*c )89 { 90 struct msn_data *md = c-> gc->proto_data;88 struct msn_switchboard *msn_sb_by_chat( struct groupchat *c ) 89 { 90 struct msn_data *md = c->ic->proto_data; 91 91 struct msn_switchboard *sb; 92 92 GSList *l; … … 102 102 } 103 103 104 struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc )105 { 106 struct msn_data *md = gc->proto_data;104 struct msn_switchboard *msn_sb_spare( struct im_connection *ic ) 105 { 106 struct msn_data *md = ic->proto_data; 107 107 struct msn_switchboard *sb; 108 108 GSList *l; … … 142 142 else 143 143 { 144 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb-> gc->username );144 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->username ); 145 145 buf = g_new0( char, i ); 146 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb-> gc->username );146 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->username ); 147 147 } 148 148 … … 177 177 } 178 178 179 struct conversation*msn_sb_to_chat( struct msn_switchboard *sb )180 { 181 struct gaim_connection *gc = sb->gc;179 struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb ) 180 { 181 struct im_connection *ic = sb->ic; 182 182 char buf[1024]; 183 183 184 184 /* Create the groupchat structure. */ 185 185 g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session ); 186 sb->chat = serv_got_joined_chat( gc, buf );186 sb->chat = serv_got_joined_chat( ic, buf ); 187 187 188 188 /* Populate the channel. */ 189 189 if( sb->who ) add_chat_buddy( sb->chat, sb->who ); 190 add_chat_buddy( sb->chat, gc->username );190 add_chat_buddy( sb->chat, ic->username ); 191 191 192 192 /* And make sure the switchboard doesn't look like a regular chat anymore. */ … … 202 202 void msn_sb_destroy( struct msn_switchboard *sb ) 203 203 { 204 struct gaim_connection *gc = sb->gc;205 struct msn_data *md = gc->proto_data;204 struct im_connection *ic = sb->ic; 205 struct msn_data *md = ic->proto_data; 206 206 207 207 debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" ); … … 222 222 g_slist_free( sb->msgq ); 223 223 224 serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "224 serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with " 225 225 "unsent message to %s, you'll have to resend it.", 226 226 sb->who ? sb->who : "(unknown)" ); … … 253 253 { 254 254 struct msn_switchboard *sb = data; 255 struct gaim_connection *gc;255 struct im_connection *ic; 256 256 struct msn_data *md; 257 257 char buf[1024]; … … 261 261 return FALSE; 262 262 263 gc = sb->gc;264 md = gc->proto_data;263 ic = sb->ic; 264 md = ic->proto_data; 265 265 266 266 if( source != sb->fd ) … … 280 280 281 281 if( sb->session == MSN_SB_NEW ) 282 g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, gc->username, sb->key );282 g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->username, sb->key ); 283 283 else 284 g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, gc->username, sb->key, sb->session );284 g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->username, sb->key, sb->session ); 285 285 286 286 if( msn_sb_write( sb, buf, strlen( buf ) ) ) … … 310 310 { 311 311 struct msn_switchboard *sb = data; 312 struct gaim_connection *gc = sb->gc;312 struct im_connection *ic = sb->ic; 313 313 char buf[1024]; 314 314 … … 321 321 if( strcmp( cmd[0], "XFR" ) == 0 ) 322 322 { 323 hide_login_progress_error( gc, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );324 signoff( gc );323 hide_login_progress_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" ); 324 signoff( ic ); 325 325 return( 0 ); 326 326 } … … 374 374 { 375 375 g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session ); 376 sb->chat = serv_got_joined_chat( gc, buf );376 sb->chat = serv_got_joined_chat( ic, buf ); 377 377 378 378 g_free( sb->who ); … … 384 384 if( num == tot ) 385 385 { 386 add_chat_buddy( sb->chat, gc->username );386 add_chat_buddy( sb->chat, ic->username ); 387 387 } 388 388 } … … 529 529 530 530 g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text ); 531 do_error_dialog( gc, buf, "MSN" );531 do_error_dialog( ic, buf, "MSN" ); 532 532 533 533 if( err->flags & STATUS_SB_FATAL ) … … 538 538 else if( err->flags & STATUS_FATAL ) 539 539 { 540 signoff( gc );540 signoff( ic ); 541 541 return 0; 542 542 } … … 579 579 { 580 580 struct msn_switchboard *sb = data; 581 struct gaim_connection *gc = sb->gc;581 struct im_connection *ic = sb->ic; 582 582 char *body; 583 583 int blen = 0; … … 608 608 if( sb->who ) 609 609 { 610 serv_got_im( gc, cmd[1], body, 0, 0, blen );610 serv_got_im( ic, cmd[1], body, 0, 0, blen ); 611 611 } 612 612 else if( sb->chat ) … … 667 667 if( sb->who ) 668 668 { 669 serv_got_im( gc, cmd[1], buf, 0, 0, strlen( buf ) );669 serv_got_im( ic, cmd[1], buf, 0, 0, strlen( buf ) ); 670 670 } 671 671 else if( sb->chat ) … … 684 684 if( who ) 685 685 { 686 serv_got_typing( gc, who, 5, 1 );686 serv_got_typing( ic, who, 5, 1 ); 687 687 g_free( who ); 688 688 }
Note: See TracChangeset
for help on using the changeset viewer.