Changeset 0da65d5 for protocols/msn


Ignore:
Timestamp:
2007-03-31T05:40:45Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
aef4828
Parents:
fa29d093
Message:

s/gaim_connection/im_connection/ and some other minor API changes. The rest
will come tomorrow. It compiles, I'll leave the real testing up to someone
else. ;-)

Location:
protocols/msn
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    rfa29d093 r0da65d5  
    2929static char *msn_set_display_name( set_t *set, char *value );
    3030
    31 static void msn_acc_init( account_t *acc )
     31static void msn_init( account_t *acc )
    3232{
    3333        set_t *s;
     
    3939static void msn_login( account_t *acc )
    4040{
    41         struct gaim_connection *gc = new_gaim_conn( acc );
     41        struct im_connection *ic = new_gaim_conn( acc );
    4242        struct msn_data *md = g_new0( struct msn_data, 1 );
    4343       
    44         gc->proto_data = md;
     44        ic->proto_data = md;
    4545        md->fd = -1;
    4646       
    4747        if( strchr( acc->user, '@' ) == NULL )
    4848        {
    49                 hide_login_progress( gc, "Invalid account name" );
    50                 signoff( gc );
     49                hide_login_progress( ic, "Invalid account name" );
     50                signoff( ic );
    5151                return;
    5252        }
    5353       
    54         set_login_progress( gc, 1, "Connecting" );
    55        
    56         md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, gc );
     54        set_login_progress( ic, 1, "Connecting" );
     55       
     56        md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic );
    5757        if( md->fd < 0 )
    5858        {
    59                 hide_login_progress( gc, "Could not connect to server" );
    60                 signoff( gc );
     59                hide_login_progress( ic, "Could not connect to server" );
     60                signoff( ic );
    6161                return;
    6262        }
    6363       
    64         md->gc = gc;
     64        md->ic = ic;
    6565        md->away_state = msn_away_state_list;
    6666       
    67         msn_connections = g_slist_append( msn_connections, gc );
    68 }
    69 
    70 static void msn_close( struct gaim_connection *gc )
    71 {
    72         struct msn_data *md = gc->proto_data;
     67        msn_connections = g_slist_append( msn_connections, ic );
     68}
     69
     70static void msn_logout( struct im_connection *ic )
     71{
     72        struct msn_data *md = ic->proto_data;
    7373        GSList *l;
    7474       
     
    9696                                m = l->data;
    9797                       
    98                                 serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
     98                                serv_got_crap( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
    9999                                g_free( m->who );
    100100                                g_free( m->text );
     
    111111        }
    112112       
    113         for( l = gc->permit; l; l = l->next )
     113        for( l = ic->permit; l; l = l->next )
    114114                g_free( l->data );
    115         g_slist_free( gc->permit );
    116        
    117         for( l = gc->deny; l; l = l->next )
     115        g_slist_free( ic->permit );
     116       
     117        for( l = ic->deny; l; l = l->next )
    118118                g_free( l->data );
    119         g_slist_free( gc->deny );
    120        
    121         msn_connections = g_slist_remove( msn_connections, gc );
    122 }
    123 
    124 static int msn_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
     119        g_slist_free( ic->deny );
     120       
     121        msn_connections = g_slist_remove( msn_connections, ic );
     122}
     123
     124static int msn_send_im( struct im_connection *ic, char *who, char *message, int away )
    125125{
    126126        struct msn_switchboard *sb;
    127         struct msn_data *md = gc->proto_data;
    128        
    129         if( ( sb = msn_sb_by_handle( gc, who ) ) )
     127        struct msn_data *md = ic->proto_data;
     128       
     129        if( ( sb = msn_sb_by_handle( ic, who ) ) )
    130130        {
    131131                return( msn_sb_sendmessage( sb, message ) );
     
    142142               
    143143                /* FIXME: *CHECK* the reliability of using spare sb's! */
    144                 if( ( sb = msn_sb_spare( gc ) ) )
     144                if( ( sb = msn_sb_spare( ic ) ) )
    145145                {
    146146                        debug( "Trying to use a spare switchboard to message %s", who );
     
    160160                /* If we reach this line, there was no spare switchboard, so let's make one. */
    161161                g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    162                 if( !msn_write( gc, buf, strlen( buf ) ) )
     162                if( !msn_write( ic, buf, strlen( buf ) ) )
    163163                {
    164164                        g_free( m->who );
     
    180180}
    181181
    182 static GList *msn_away_states( struct gaim_connection *gc )
     182static GList *msn_away_states( struct im_connection *ic )
    183183{
    184184        static GList *l = NULL;
     
    192192}
    193193
    194 static char *msn_get_status_string( struct gaim_connection *gc, int number )
     194static char *msn_get_status_string( struct im_connection *ic, int number )
    195195{
    196196        const struct msn_away_state *st = msn_away_state_by_number( number );
     
    202202}
    203203
    204 static void msn_set_away( struct gaim_connection *gc, char *state, char *message )
     204static void msn_set_away( struct im_connection *ic, char *state, char *message )
    205205{
    206206        char buf[1024];
    207         struct msn_data *md = gc->proto_data;
     207        struct msn_data *md = ic->proto_data;
    208208        const struct msn_away_state *st;
    209209       
     
    217217       
    218218        g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code );
    219         msn_write( gc, buf, strlen( buf ) );
    220 }
    221 
    222 static void msn_set_info( struct gaim_connection *gc, char *info )
    223 {
    224         msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info );
    225 }
    226 
    227 static void msn_get_info(struct gaim_connection *gc, char *who)
     219        msn_write( ic, buf, strlen( buf ) );
     220}
     221
     222static void msn_set_my_name( struct im_connection *ic, char *info )
     223{
     224        msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
     225}
     226
     227static void msn_get_info(struct im_connection *ic, char *who)
    228228{
    229229        /* Just make an URL and let the user fetch the info */
    230         serv_got_crap( gc, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
    231 }
    232 
    233 static void msn_add_buddy( struct gaim_connection *gc, char *who )
    234 {
    235         msn_buddy_list_add( gc, "FL", who, who );
    236 }
    237 
    238 static void msn_remove_buddy( struct gaim_connection *gc, char *who, char *group )
    239 {
    240         msn_buddy_list_remove( gc, "FL", who );
    241 }
    242 
    243 static int msn_chat_send( struct conversation *c, char *message )
     230        serv_got_crap( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
     231}
     232
     233static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
     234{
     235        msn_buddy_list_add( ic, "FL", who, who );
     236}
     237
     238static void msn_remove_buddy( struct im_connection *ic, char *who, char *group )
     239{
     240        msn_buddy_list_remove( ic, "FL", who );
     241}
     242
     243static void msn_chat_send( struct groupchat *c, char *message, int flags )
    244244{
    245245        struct msn_switchboard *sb = msn_sb_by_chat( c );
    246246       
    247247        if( sb )
    248                 return( msn_sb_sendmessage( sb, message ) );
    249         else
    250                 return( 0 );
    251 }
    252 
    253 static void msn_chat_invite( struct conversation *c, char *msg, char *who )
     248                msn_sb_sendmessage( sb, message );
     249        /* FIXME: Error handling (although this can't happen unless something's
     250           already severely broken) disappeared here! */
     251}
     252
     253static void msn_chat_invite( struct groupchat *c, char *msg, char *who )
    254254{
    255255        struct msn_switchboard *sb = msn_sb_by_chat( c );
     
    263263}
    264264
    265 static void msn_chat_leave( struct conversation *c )
     265static void msn_chat_leave( struct groupchat *c )
    266266{
    267267        struct msn_switchboard *sb = msn_sb_by_chat( c );
     
    271271}
    272272
    273 static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who )
     273static struct groupchat *msn_chat_with( struct im_connection *ic, char *who )
    274274{
    275275        struct msn_switchboard *sb;
    276         struct msn_data *md = gc->proto_data;
     276        struct msn_data *md = ic->proto_data;
    277277        char buf[1024];
    278278       
    279         if( ( sb = msn_sb_by_handle( gc, who ) ) )
     279        if( ( sb = msn_sb_by_handle( ic, who ) ) )
    280280        {
    281281                debug( "Converting existing switchboard to %s to a groupchat", who );
     
    286286                struct msn_message *m;
    287287               
    288                 if( ( sb = msn_sb_spare( gc ) ) )
     288                if( ( sb = msn_sb_spare( ic ) ) )
    289289                {
    290290                        debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );
     
    299299                /* Request a new switchboard. */
    300300                g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    301                 if( !msn_write( gc, buf, strlen( buf ) ) )
     301                if( !msn_write( ic, buf, strlen( buf ) ) )
    302302                        return( 0 );
    303303               
     
    317317}
    318318
    319 static void msn_keepalive( struct gaim_connection *gc )
    320 {
    321         msn_write( gc, "PNG\r\n", strlen( "PNG\r\n" ) );
    322 }
    323 
    324 static void msn_add_permit( struct gaim_connection *gc, char *who )
    325 {
    326         msn_buddy_list_add( gc, "AL", who, who );
    327 }
    328 
    329 static void msn_rem_permit( struct gaim_connection *gc, char *who )
    330 {
    331         msn_buddy_list_remove( gc, "AL", who );
    332 }
    333 
    334 static void msn_add_deny( struct gaim_connection *gc, char *who )
     319static void msn_keepalive( struct im_connection *ic )
     320{
     321        msn_write( ic, "PNG\r\n", strlen( "PNG\r\n" ) );
     322}
     323
     324static void msn_add_permit( struct im_connection *ic, char *who )
     325{
     326        msn_buddy_list_add( ic, "AL", who, who );
     327}
     328
     329static void msn_rem_permit( struct im_connection *ic, char *who )
     330{
     331        msn_buddy_list_remove( ic, "AL", who );
     332}
     333
     334static void msn_add_deny( struct im_connection *ic, char *who )
    335335{
    336336        struct msn_switchboard *sb;
    337337       
    338         msn_buddy_list_add( gc, "BL", who, who );
     338        msn_buddy_list_add( ic, "BL", who, who );
    339339       
    340340        /* If there's still a conversation with this person, close it. */
    341         if( ( sb = msn_sb_by_handle( gc, who ) ) )
     341        if( ( sb = msn_sb_by_handle( ic, who ) ) )
    342342        {
    343343                msn_sb_destroy( sb );
     
    345345}
    346346
    347 static void msn_rem_deny( struct gaim_connection *gc, char *who )
    348 {
    349         msn_buddy_list_remove( gc, "BL", who );
    350 }
    351 
    352 static int msn_send_typing( struct gaim_connection *gc, char *who, int typing )
     347static void msn_rem_deny( struct im_connection *ic, char *who )
     348{
     349        msn_buddy_list_remove( ic, "BL", who );
     350}
     351
     352static int msn_send_typing( struct im_connection *ic, char *who, int typing )
    353353{
    354354        if( typing )
    355                 return( msn_send_im( gc, who, TYPING_NOTIFICATION_MESSAGE, strlen( TYPING_NOTIFICATION_MESSAGE ), 0 ) );
     355                return( msn_send_im( ic, who, TYPING_NOTIFICATION_MESSAGE, 0 ) );
    356356        else
    357357                return( 1 );
     
    361361{
    362362        account_t *acc = set->data;
    363         struct gaim_connection *gc = acc->gc;
     363        struct im_connection *ic = acc->ic;
    364364        struct msn_data *md;
    365365        char buf[1024], *fn;
    366366       
    367367        /* Double-check. */
    368         if( gc == NULL )
     368        if( ic == NULL )
    369369                return NULL;
    370370       
    371         md = gc->proto_data;
     371        md = ic->proto_data;
    372372       
    373373        if( strlen( value ) > 129 )
    374374        {
    375                 serv_got_crap( gc, "Maximum name length exceeded" );
     375                serv_got_crap( ic, "Maximum name length exceeded" );
    376376                return NULL;
    377377        }
     
    379379        fn = msn_http_encode( value );
    380380       
    381         g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn );
    382         msn_write( gc, buf, strlen( buf ) );
     381        g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->username, fn );
     382        msn_write( ic, buf, strlen( buf ) );
    383383        g_free( fn );
    384384       
     
    389389}
    390390
    391 void msn_init()
     391void msn_initmodule()
    392392{
    393393        struct prpl *ret = g_new0(struct prpl, 1);
     
    395395        ret->name = "msn";
    396396        ret->login = msn_login;
    397         ret->acc_init = msn_acc_init;
    398         ret->close = msn_close;
     397        ret->init = msn_init;
     398        ret->logout = msn_logout;
    399399        ret->send_im = msn_send_im;
    400400        ret->away_states = msn_away_states;
    401401        ret->get_status_string = msn_get_status_string;
    402402        ret->set_away = msn_set_away;
    403         ret->set_info = msn_set_info;
    404403        ret->get_info = msn_get_info;
     404        ret->set_my_name = msn_set_my_name;
    405405        ret->add_buddy = msn_add_buddy;
    406406        ret->remove_buddy = msn_remove_buddy;
     
    408408        ret->chat_invite = msn_chat_invite;
    409409        ret->chat_leave = msn_chat_leave;
    410         ret->chat_open = msn_chat_open;
     410        ret->chat_with = msn_chat_with;
    411411        ret->keepalive = msn_keepalive;
    412412        ret->add_permit = msn_add_permit;
  • protocols/msn/msn.h

    rfa29d093 r0da65d5  
    5757struct msn_data
    5858{
    59         struct gaim_connection *gc;
     59        struct im_connection *ic;
    6060       
    6161        int fd;
     
    7575struct msn_switchboard
    7676{
    77         struct gaim_connection *gc;
     77        struct im_connection *ic;
    7878       
    7979        int fd;
     
    8989        GSList *msgq;
    9090        char *who;
    91         struct conversation *chat;
     91        struct groupchat *chat;
    9292};
    9393
     
    149149
    150150/* msn_util.c */
    151 int msn_write( struct gaim_connection *gc, char *s, int len );
    152 int msn_logged_in( struct gaim_connection *gc );
    153 int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname );
    154 int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who );
    155 void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname );
     151int msn_write( struct im_connection *ic, char *s, int len );
     152int msn_logged_in( struct im_connection *ic );
     153int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname );
     154int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
     155void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
    156156char *msn_findheader( char *text, char *header, int len );
    157157char **msn_linesplit( char *line );
     
    167167/* sb.c */
    168168int msn_sb_write( struct msn_switchboard *sb, char *s, int len );
    169 struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session );
    170 struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle );
    171 struct msn_switchboard *msn_sb_by_chat( struct conversation *c );
    172 struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc );
     169struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
     170struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle );
     171struct msn_switchboard *msn_sb_by_chat( struct groupchat *c );
     172struct msn_switchboard *msn_sb_spare( struct im_connection *ic );
    173173int msn_sb_sendmessage( struct msn_switchboard *sb, char *text );
    174 struct conversation *msn_sb_to_chat( struct msn_switchboard *sb );
     174struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb );
    175175void msn_sb_destroy( struct msn_switchboard *sb );
    176176gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
  • protocols/msn/msn_util.c

    rfa29d093 r0da65d5  
    2828#include <ctype.h>
    2929
    30 int msn_write( struct gaim_connection *gc, char *s, int len )
    31 {
    32         struct msn_data *md = gc->proto_data;
     30int msn_write( struct im_connection *ic, char *s, int len )
     31{
     32        struct msn_data *md = ic->proto_data;
    3333        int st;
    3434       
     
    3636        if( st != len )
    3737        {
    38                 hide_login_progress_error( gc, "Short write() to main server" );
    39                 signoff( gc );
     38                hide_login_progress_error( ic, "Short write() to main server" );
     39                signoff( ic );
    4040                return( 0 );
    4141        }
     
    4444}
    4545
    46 int msn_logged_in( struct gaim_connection *gc )
    47 {
    48         account_online( gc );
     46int msn_logged_in( struct im_connection *ic )
     47{
     48        account_online( ic );
    4949       
    5050        return( 0 );
    5151}
    5252
    53 int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname_ )
    54 {
    55         struct msn_data *md = gc->proto_data;
     53int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname_ )
     54{
     55        struct msn_data *md = ic->proto_data;
    5656        char buf[1024], *realname;
    5757       
     
    5959       
    6060        g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname );
    61         if( msn_write( gc, buf, strlen( buf ) ) )
     61        if( msn_write( ic, buf, strlen( buf ) ) )
    6262        {
    6363                g_free( realname );
     
    7171}
    7272
    73 int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who )
    74 {
    75         struct msn_data *md = gc->proto_data;
     73int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who )
     74{
     75        struct msn_data *md = ic->proto_data;
    7676        char buf[1024];
    7777       
    7878        g_snprintf( buf, sizeof( buf ), "REM %d %s %s\r\n", ++md->trId, list, who );
    79         if( msn_write( gc, buf, strlen( buf ) ) )
     79        if( msn_write( ic, buf, strlen( buf ) ) )
    8080                return( 1 );
    8181       
     
    8585struct msn_buddy_ask_data
    8686{
    87         struct gaim_connection *gc;
     87        struct im_connection *ic;
    8888        char *handle;
    8989        char *realname;
     
    9292static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
    9393{
    94         msn_buddy_list_add( bla->gc, "AL", bla->handle, bla->realname );
    95        
    96         if( find_buddy( bla->gc, bla->handle ) == NULL )
    97                 show_got_added( bla->gc, bla->handle, NULL );
     94        msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname );
     95       
     96        if( find_buddy( bla->ic, bla->handle ) == NULL )
     97                show_got_added( bla->ic, bla->handle, NULL );
    9898       
    9999        g_free( bla->handle );
     
    104104static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla )
    105105{
    106         msn_buddy_list_add( bla->gc, "BL", bla->handle, bla->realname );
     106        msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname );
    107107       
    108108        g_free( bla->handle );
     
    111111}
    112112
    113 void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname )
     113void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname )
    114114{
    115115        struct msn_buddy_ask_data *bla = g_new0( struct msn_buddy_ask_data, 1 );
    116116        char buf[1024];
    117117       
    118         bla->gc = gc;
     118        bla->ic = ic;
    119119        bla->handle = g_strdup( handle );
    120120        bla->realname = g_strdup( realname );
     
    123123                    "The user %s (%s) wants to add you to his/her buddy list.",
    124124                    handle, realname );
    125         do_ask_dialog( gc, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
     125        do_ask_dialog( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
    126126}
    127127
  • protocols/msn/ns.c

    rfa29d093 r0da65d5  
    3838gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
    3939{
    40         struct gaim_connection *gc = data;
     40        struct im_connection *ic = data;
    4141        struct msn_data *md;
    4242        char s[1024];
    4343       
    44         if( !g_slist_find( msn_connections, gc ) )
     44        if( !g_slist_find( msn_connections, ic ) )
    4545                return FALSE;
    4646       
    4747        if( source == -1 )
    4848        {
    49                 hide_login_progress( gc, "Could not connect to server" );
    50                 signoff( gc );
     49                hide_login_progress( ic, "Could not connect to server" );
     50                signoff( ic );
    5151                return FALSE;
    5252        }
    5353       
    54         md = gc->proto_data;
     54        md = ic->proto_data;
    5555       
    5656        if( !md->handler )
    5757        {
    5858                md->handler = g_new0( struct msn_handler_data, 1 );
    59                 md->handler->data = gc;
     59                md->handler->data = ic;
    6060                md->handler->exec_command = msn_ns_command;
    6161                md->handler->exec_message = msn_ns_message;
     
    7373       
    7474        g_snprintf( s, sizeof( s ), "VER %d MSNP8 CVR0\r\n", ++md->trId );
    75         if( msn_write( gc, s, strlen( s ) ) )
    76         {
    77                 gc->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc );
    78                 set_login_progress( gc, 1, "Connected to server, waiting for reply" );
     75        if( msn_write( ic, s, strlen( s ) ) )
     76        {
     77                ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
     78                set_login_progress( ic, 1, "Connected to server, waiting for reply" );
    7979        }
    8080       
     
    8484static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond )
    8585{
    86         struct gaim_connection *gc = data;
    87         struct msn_data *md = gc->proto_data;
     86        struct im_connection *ic = data;
     87        struct msn_data *md = ic->proto_data;
    8888       
    8989        if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */
    9090        {
    91                 hide_login_progress( gc, "Error while reading from server" );
    92                 signoff( gc );
     91                hide_login_progress( ic, "Error while reading from server" );
     92                signoff( ic );
    9393               
    9494                return FALSE;
     
    100100static int msn_ns_command( gpointer data, char **cmd, int num_parts )
    101101{
    102         struct gaim_connection *gc = data;
    103         struct msn_data *md = gc->proto_data;
     102        struct im_connection *ic = data;
     103        struct msn_data *md = ic->proto_data;
    104104        char buf[1024];
    105105       
     
    114114                if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )
    115115                {
    116                         hide_login_progress( gc, "Unsupported protocol" );
    117                         signoff( gc );
     116                        hide_login_progress( ic, "Unsupported protocol" );
     117                        signoff( ic );
    118118                        return( 0 );
    119119                }
    120120               
    121121                g_snprintf( buf, sizeof( buf ), "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s\r\n",
    122                                                 ++md->trId, gc->username );
    123                 return( msn_write( gc, buf, strlen( buf ) ) );
     122                                                ++md->trId, ic->username );
     123                return( msn_write( ic, buf, strlen( buf ) ) );
    124124        }
    125125        else if( strcmp( cmd[0], "CVR" ) == 0 )
    126126        {
    127127                /* We don't give a damn about the information we just received */
    128                 g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, gc->username );
    129                 return( msn_write( gc, buf, strlen( buf ) ) );
     128                g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, ic->username );
     129                return( msn_write( ic, buf, strlen( buf ) ) );
    130130        }
    131131        else if( strcmp( cmd[0], "XFR" ) == 0 )
     
    136136                if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 )
    137137                {
    138                         b_event_remove( gc->inpa );
    139                         gc->inpa = 0;
     138                        b_event_remove( ic->inpa );
     139                        ic->inpa = 0;
    140140                        closesocket( md->fd );
    141141                       
     
    143143                        if( !server )
    144144                        {
    145                                 hide_login_progress_error( gc, "Syntax error" );
    146                                 signoff( gc );
     145                                hide_login_progress_error( ic, "Syntax error" );
     146                                signoff( ic );
    147147                                return( 0 );
    148148                        }
     
    151151                        server = cmd[3];
    152152                       
    153                         set_login_progress( gc, 1, "Transferring to other server" );
    154                        
    155                         md->fd = proxy_connect( server, port, msn_ns_connected, gc );
     153                        set_login_progress( ic, 1, "Transferring to other server" );
     154                       
     155                        md->fd = proxy_connect( server, port, msn_ns_connected, ic );
    156156                }
    157157                else if( num_parts == 6 && strcmp( cmd[2], "SB" ) == 0 )
     
    162162                        if( !server )
    163163                        {
    164                                 hide_login_progress_error( gc, "Syntax error" );
    165                                 signoff( gc );
     164                                hide_login_progress_error( ic, "Syntax error" );
     165                                signoff( ic );
    166166                                return( 0 );
    167167                        }
     
    172172                        if( strcmp( cmd[4], "CKI" ) != 0 )
    173173                        {
    174                                 hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
    175                                 signoff( gc );
     174                                hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
     175                                signoff( ic );
    176176                                return( 0 );
    177177                        }
    178178                       
    179179                        debug( "Connecting to a new switchboard with key %s", cmd[5] );
    180                         sb = msn_sb_create( gc, server, port, cmd[5], MSN_SB_NEW );
     180                        sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
    181181                       
    182182                        if( md->msgq )
     
    204204                else
    205205                {
    206                         hide_login_progress_error( gc, "Syntax error" );
    207                         signoff( gc );
     206                        hide_login_progress_error( ic, "Syntax error" );
     207                        signoff( ic );
    208208                        return( 0 );
    209209                }
     
    214214                {
    215215                        /* Time for some Passport black magic... */
    216                         if( !passport_get_id( msn_auth_got_passport_id, gc, gc->username, gc->password, cmd[4] ) )
    217                         {
    218                                 hide_login_progress_error( gc, "Error while contacting Passport server" );
    219                                 signoff( gc );
     216                        if( !passport_get_id( msn_auth_got_passport_id, ic, ic->username, ic->password, cmd[4] ) )
     217                        {
     218                                hide_login_progress_error( ic, "Error while contacting Passport server" );
     219                                signoff( ic );
    220220                                return( 0 );
    221221                        }
     
    227227                        http_decode( cmd[4] );
    228228                       
    229                         strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
    230                         gc->displayname[sizeof(gc->displayname)-1] = 0;
    231                        
    232                         if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
     229                        strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
     230                        ic->displayname[sizeof(ic->displayname)-1] = 0;
     231                       
     232                        if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
    233233                        {
    234234                                g_free( s->value );
     
    236236                        }
    237237                       
    238                         set_login_progress( gc, 1, "Authenticated, getting buddy list" );
     238                        set_login_progress( ic, 1, "Authenticated, getting buddy list" );
    239239                       
    240240                        g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );
    241                         return( msn_write( gc, buf, strlen( buf ) ) );
     241                        return( msn_write( ic, buf, strlen( buf ) ) );
    242242                }
    243243                else
    244244                {
    245                         hide_login_progress( gc, "Unknown authentication type" );
    246                         signoff( gc );
     245                        hide_login_progress( ic, "Unknown authentication type" );
     246                        signoff( ic );
    247247                        return( 0 );
    248248                }
     
    252252                if( num_parts != 4 )
    253253                {
    254                         hide_login_progress_error( gc, "Syntax error" );
    255                         signoff( gc );
     254                        hide_login_progress_error( ic, "Syntax error" );
     255                        signoff( ic );
    256256                        return( 0 );
    257257                }
     
    261261                if( md->handler->msglen <= 0 )
    262262                {
    263                         hide_login_progress_error( gc, "Syntax error" );
    264                         signoff( gc );
     263                        hide_login_progress_error( ic, "Syntax error" );
     264                        signoff( ic );
    265265                        return( 0 );
    266266                }
     
    276276                       
    277277                        if( !*cmd[3] || md->buddycount == 0 )
    278                                 msn_logged_in( gc );
     278                                msn_logged_in( ic );
    279279                }
    280280                else
     
    283283                           Let's assume everything is okay. */
    284284                       
    285                         msn_logged_in( gc );
     285                        msn_logged_in( ic );
    286286                }
    287287        }
     
    292292                if( num_parts != 4 && num_parts != 5 )
    293293                {
    294                         hide_login_progress( gc, "Syntax error" );
    295                         signoff( gc );
     294                        hide_login_progress( ic, "Syntax error" );
     295                        signoff( ic );
    296296                        return( 0 );
    297297                }
     
    308308                                group = md->grouplist[num];
    309309                       
    310                         add_buddy( gc, group, cmd[1], cmd[2] );
     310                        add_buddy( ic, group, cmd[1], cmd[2] );
    311311                }
    312312                if( list & 2 ) /* AL */
    313313                {
    314                         gc->permit = g_slist_append( gc->permit, g_strdup( cmd[1] ) );
     314                        ic->permit = g_slist_append( ic->permit, g_strdup( cmd[1] ) );
    315315                }
    316316                if( list & 4 ) /* BL */
    317317                {
    318                         gc->deny = g_slist_append( gc->deny, g_strdup( cmd[1] ) );
     318                        ic->deny = g_slist_append( ic->deny, g_strdup( cmd[1] ) );
    319319                }
    320320                if( list & 8 ) /* RL */
    321321                {
    322322                        if( ( list & 6 ) == 0 )
    323                                 msn_buddy_ask( gc, cmd[1], cmd[2] );
     323                                msn_buddy_ask( ic, cmd[1], cmd[2] );
    324324                }
    325325               
    326326                if( --md->buddycount == 0 )
    327327                {
    328                         if( gc->flags & OPT_LOGGED_IN )
    329                         {
    330                                 serv_got_crap( gc, "Successfully transferred to different server" );
     328                        if( ic->flags & OPT_LOGGED_IN )
     329                        {
     330                                serv_got_crap( ic, "Successfully transferred to different server" );
    331331                                g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 );
    332                                 return( msn_write( gc, buf, strlen( buf ) ) );
     332                                return( msn_write( ic, buf, strlen( buf ) ) );
    333333                        }
    334334                        else
    335335                        {
    336                                 msn_logged_in( gc );
     336                                msn_logged_in( ic );
    337337                        }
    338338                }
     
    344344                if( num_parts != 4 )
    345345                {
    346                         hide_login_progress_error( gc, "Syntax error" );
    347                         signoff( gc );
     346                        hide_login_progress_error( ic, "Syntax error" );
     347                        signoff( ic );
    348348                        return( 0 );
    349349                }
     
    363363                if( num_parts != 3 )
    364364                {
    365                         hide_login_progress_error( gc, "Syntax error" );
    366                         signoff( gc );
     365                        hide_login_progress_error( ic, "Syntax error" );
     366                        signoff( ic );
    367367                        return( 0 );
    368368                }
     
    377377                        g_snprintf( buf + strlen( buf ), 3, "%02x", digest[i] );
    378378               
    379                 return( msn_write( gc, buf, strlen( buf ) ) );
     379                return( msn_write( ic, buf, strlen( buf ) ) );
    380380        }
    381381        else if( strcmp( cmd[0], "ILN" ) == 0 )
     
    385385                if( num_parts != 6 )
    386386                {
    387                         hide_login_progress_error( gc, "Syntax error" );
    388                         signoff( gc );
     387                        hide_login_progress_error( ic, "Syntax error" );
     388                        signoff( ic );
    389389                        return( 0 );
    390390                }
    391391               
    392392                http_decode( cmd[4] );
    393                 serv_buddy_rename( gc, cmd[3], cmd[4] );
     393                serv_buddy_rename( ic, cmd[3], cmd[4] );
    394394               
    395395                st = msn_away_state_by_code( cmd[2] );
     
    400400                }
    401401               
    402                 serv_got_update( gc, cmd[3], 1, 0, 0, 0, st->number, 0 );
     402                serv_got_update( ic, cmd[3], 1, 0, 0, 0, st->number, 0 );
    403403        }
    404404        else if( strcmp( cmd[0], "FLN" ) == 0 )
    405405        {
    406406                if( cmd[1] )
    407                         serv_got_update( gc, cmd[1], 0, 0, 0, 0, 0, 0 );
     407                        serv_got_update( ic, cmd[1], 0, 0, 0, 0, 0, 0 );
    408408        }
    409409        else if( strcmp( cmd[0], "NLN" ) == 0 )
     
    413413                if( num_parts != 5 )
    414414                {
    415                         hide_login_progress_error( gc, "Syntax error" );
    416                         signoff( gc );
     415                        hide_login_progress_error( ic, "Syntax error" );
     416                        signoff( ic );
    417417                        return( 0 );
    418418                }
    419419               
    420420                http_decode( cmd[3] );
    421                 serv_buddy_rename( gc, cmd[2], cmd[3] );
     421                serv_buddy_rename( ic, cmd[2], cmd[3] );
    422422               
    423423                st = msn_away_state_by_code( cmd[1] );
     
    428428                }
    429429               
    430                 serv_got_update( gc, cmd[2], 1, 0, 0, 0, st->number, 0 );
     430                serv_got_update( ic, cmd[2], 1, 0, 0, 0, st->number, 0 );
    431431        }
    432432        else if( strcmp( cmd[0], "RNG" ) == 0 )
     
    438438                if( num_parts != 7 )
    439439                {
    440                         hide_login_progress_error( gc, "Syntax error" );
    441                         signoff( gc );
     440                        hide_login_progress_error( ic, "Syntax error" );
     441                        signoff( ic );
    442442                        return( 0 );
    443443                }
     
    448448                if( !server )
    449449                {
    450                         hide_login_progress_error( gc, "Syntax error" );
    451                         signoff( gc );
     450                        hide_login_progress_error( ic, "Syntax error" );
     451                        signoff( ic );
    452452                        return( 0 );
    453453                }
     
    458458                if( strcmp( cmd[3], "CKI" ) != 0 )
    459459                {
    460                         hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
    461                         signoff( gc );
     460                        hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
     461                        signoff( ic );
    462462                        return( 0 );
    463463                }
     
    465465                debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
    466466               
    467                 sb = msn_sb_create( gc, server, port, cmd[4], session );
     467                sb = msn_sb_create( ic, server, port, cmd[4], session );
    468468                sb->who = g_strdup( cmd[5] );
    469469        }
     
    478478                        if( strchr( cmd[4], '@' ) == NULL )
    479479                        {
    480                                 hide_login_progress_error( gc, "Syntax error" );
    481                                 signoff( gc );
     480                                hide_login_progress_error( ic, "Syntax error" );
     481                                signoff( ic );
    482482                                return( 0 );
    483483                        }
    484484                       
    485485                        /* We got added by someone. If we don't have this person in permit/deny yet, inform the user. */
    486                         for( l = gc->permit; l; l = l->next )
     486                        for( l = ic->permit; l; l = l->next )
    487487                                if( g_strcasecmp( l->data, cmd[4] ) == 0 )
    488488                                        return( 1 );
    489489                       
    490                         for( l = gc->deny; l; l = l->next )
     490                        for( l = ic->deny; l; l = l->next )
    491491                                if( g_strcasecmp( l->data, cmd[4] ) == 0 )
    492492                                        return( 1 );
    493493                       
    494                         msn_buddy_ask( gc, cmd[4], cmd[5] );
     494                        msn_buddy_ask( ic, cmd[4], cmd[5] );
    495495                }
    496496        }
     
    499499                if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )
    500500                {
    501                         hide_login_progress_error( gc, "Someone else logged in with your account" );
    502                         gc->wants_to_die = 1;
     501                        hide_login_progress_error( ic, "Someone else logged in with your account" );
     502                        ic->wants_to_die = 1;
    503503                }
    504504                else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 )
    505505                {
    506                         hide_login_progress_error( gc, "Terminating session because of server shutdown" );
     506                        hide_login_progress_error( ic, "Terminating session because of server shutdown" );
    507507                }
    508508                else
    509509                {
    510                         hide_login_progress_error( gc, "Session terminated by remote server (reason unknown)" );
    511                 }
    512                
    513                 signoff( gc );
     510                        hide_login_progress_error( ic, "Session terminated by remote server (reason unknown)" );
     511                }
     512               
     513                signoff( ic );
    514514                return( 0 );
    515515        }
     
    518518                if( num_parts != 5 )
    519519                {
    520                         hide_login_progress_error( gc, "Syntax error" );
    521                         signoff( gc );
    522                         return( 0 );
    523                 }
    524                
    525                 if( g_strcasecmp( cmd[3], gc->username ) == 0 )
     520                        hide_login_progress_error( ic, "Syntax error" );
     521                        signoff( ic );
     522                        return( 0 );
     523                }
     524               
     525                if( g_strcasecmp( cmd[3], ic->username ) == 0 )
    526526                {
    527527                        set_t *s;
    528528                       
    529529                        http_decode( cmd[4] );
    530                         strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
    531                         gc->displayname[sizeof(gc->displayname)-1] = 0;
    532                        
    533                         if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
     530                        strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
     531                        ic->displayname[sizeof(ic->displayname)-1] = 0;
     532                       
     533                        if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
    534534                        {
    535535                                g_free( s->value );
     
    541541                        /* This is not supposed to happen, but let's handle it anyway... */
    542542                        http_decode( cmd[4] );
    543                         serv_buddy_rename( gc, cmd[3], cmd[4] );
     543                        serv_buddy_rename( ic, cmd[3], cmd[4] );
    544544                }
    545545        }
    546546        else if( strcmp( cmd[0], "IPG" ) == 0 )
    547547        {
    548                 do_error_dialog( gc, "Received IPG command, we don't handle them yet.", "MSN" );
     548                do_error_dialog( ic, "Received IPG command, we don't handle them yet.", "MSN" );
    549549               
    550550                md->handler->msglen = atoi( cmd[1] );
     
    552552                if( md->handler->msglen <= 0 )
    553553                {
    554                         hide_login_progress_error( gc, "Syntax error" );
    555                         signoff( gc );
     554                        hide_login_progress_error( ic, "Syntax error" );
     555                        signoff( ic );
    556556                        return( 0 );
    557557                }
     
    563563               
    564564                g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text );
    565                 do_error_dialog( gc, buf, "MSN" );
     565                do_error_dialog( ic, buf, "MSN" );
    566566               
    567567                if( err->flags & STATUS_FATAL )
    568568                {
    569                         signoff( gc );
     569                        signoff( ic );
    570570                        return( 0 );
    571571                }
     
    581581static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts )
    582582{
    583         struct gaim_connection *gc = data;
     583        struct im_connection *ic = data;
    584584        char *body;
    585585        int blen = 0;
     
    617617                                {
    618618                                        if( arg1 )
    619                                                 serv_got_crap( gc, "The server is going down for maintenance in %s minutes.", arg1 );
     619                                                serv_got_crap( ic, "The server is going down for maintenance in %s minutes.", arg1 );
    620620                                }
    621621                               
     
    634634                                if( inbox && folders )
    635635                                {
    636                                         serv_got_crap( gc, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
     636                                        serv_got_crap( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
    637637                                }
    638638                        }
     
    644644                                if( from && fromname )
    645645                                {
    646                                         serv_got_crap( gc, "Received an e-mail message from %s <%s>.", fromname, from );
     646                                        serv_got_crap( ic, "Received an e-mail message from %s <%s>.", fromname, from );
    647647                                }
    648648                        }
     
    665665static void msn_auth_got_passport_id( struct passport_reply *rep )
    666666{
    667         struct gaim_connection *gc = rep->data;
    668         struct msn_data *md = gc->proto_data;
     667        struct im_connection *ic = rep->data;
     668        struct msn_data *md = ic->proto_data;
    669669        char *key = rep->result;
    670670        char buf[1024];
     
    677677                                       rep->error_string ? rep->error_string : "Unknown error" );
    678678               
    679                 hide_login_progress( gc, err );
    680                 signoff( gc );
     679                hide_login_progress( ic, err );
     680                signoff( ic );
    681681               
    682682                g_free( err );
     
    685685        {
    686686                g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );
    687                 msn_write( gc, buf, strlen( buf ) );
     687                msn_write( ic, buf, strlen( buf ) );
    688688        }
    689689}
  • protocols/msn/sb.c

    rfa29d093 r0da65d5  
    4848}
    4949
    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;
     50struct 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;
    5353        struct msn_switchboard *sb = g_new0( struct msn_switchboard, 1 );
    5454       
     
    6060        }
    6161       
    62         sb->gc = gc;
     62        sb->ic = ic;
    6363        sb->key = g_strdup( key );
    6464        sb->session = session;
     
    7070}
    7171
    72 struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle )
    73 {
    74         struct msn_data *md = gc->proto_data;
     72struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle )
     73{
     74        struct msn_data *md = ic->proto_data;
    7575        struct msn_switchboard *sb;
    7676        GSList *l;
     
    8686}
    8787
    88 struct msn_switchboard *msn_sb_by_chat( struct conversation *c )
    89 {
    90         struct msn_data *md = c->gc->proto_data;
     88struct msn_switchboard *msn_sb_by_chat( struct groupchat *c )
     89{
     90        struct msn_data *md = c->ic->proto_data;
    9191        struct msn_switchboard *sb;
    9292        GSList *l;
     
    102102}
    103103
    104 struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc )
    105 {
    106         struct msn_data *md = gc->proto_data;
     104struct msn_switchboard *msn_sb_spare( struct im_connection *ic )
     105{
     106        struct msn_data *md = ic->proto_data;
    107107        struct msn_switchboard *sb;
    108108        GSList *l;
     
    142142                else
    143143                {
    144                         i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username );
     144                        i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->username );
    145145                        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 );
    147147                }
    148148               
     
    177177}
    178178
    179 struct conversation *msn_sb_to_chat( struct msn_switchboard *sb )
    180 {
    181         struct gaim_connection *gc = sb->gc;
     179struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
     180{
     181        struct im_connection *ic = sb->ic;
    182182        char buf[1024];
    183183       
    184184        /* Create the groupchat structure. */
    185185        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 );
    187187       
    188188        /* Populate the channel. */
    189189        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 );
    191191       
    192192        /* And make sure the switchboard doesn't look like a regular chat anymore. */
     
    202202void msn_sb_destroy( struct msn_switchboard *sb )
    203203{
    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;
    206206       
    207207        debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" );
     
    222222                g_slist_free( sb->msgq );
    223223               
    224                 serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "
     224                serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with "
    225225                                   "unsent message to %s, you'll have to resend it.",
    226226                                   sb->who ? sb->who : "(unknown)" );
     
    253253{
    254254        struct msn_switchboard *sb = data;
    255         struct gaim_connection *gc;
     255        struct im_connection *ic;
    256256        struct msn_data *md;
    257257        char buf[1024];
     
    261261                return FALSE;
    262262       
    263         gc = sb->gc;
    264         md = gc->proto_data;
     263        ic = sb->ic;
     264        md = ic->proto_data;
    265265       
    266266        if( source != sb->fd )
     
    280280       
    281281        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 );
    283283        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 );
    285285       
    286286        if( msn_sb_write( sb, buf, strlen( buf ) ) )
     
    310310{
    311311        struct msn_switchboard *sb = data;
    312         struct gaim_connection *gc = sb->gc;
     312        struct im_connection *ic = sb->ic;
    313313        char buf[1024];
    314314       
     
    321321        if( strcmp( cmd[0], "XFR" ) == 0 )
    322322        {
    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 );
    325325                return( 0 );
    326326        }
     
    374374                        {
    375375                                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 );
    377377                               
    378378                                g_free( sb->who );
     
    384384                        if( num == tot )
    385385                        {
    386                                 add_chat_buddy( sb->chat, gc->username );
     386                                add_chat_buddy( sb->chat, ic->username );
    387387                        }
    388388                }
     
    529529               
    530530                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" );
    532532               
    533533                if( err->flags & STATUS_SB_FATAL )
     
    538538                else if( err->flags & STATUS_FATAL )
    539539                {
    540                         signoff( gc );
     540                        signoff( ic );
    541541                        return 0;
    542542                }
     
    579579{
    580580        struct msn_switchboard *sb = data;
    581         struct gaim_connection *gc = sb->gc;
     581        struct im_connection *ic = sb->ic;
    582582        char *body;
    583583        int blen = 0;
     
    608608                        if( sb->who )
    609609                        {
    610                                 serv_got_im( gc, cmd[1], body, 0, 0, blen );
     610                                serv_got_im( ic, cmd[1], body, 0, 0, blen );
    611611                        }
    612612                        else if( sb->chat )
     
    667667                        if( sb->who )
    668668                        {
    669                                 serv_got_im( gc, cmd[1], buf, 0, 0, strlen( buf ) );
     669                                serv_got_im( ic, cmd[1], buf, 0, 0, strlen( buf ) );
    670670                        }
    671671                        else if( sb->chat )
     
    684684                        if( who )
    685685                        {
    686                                 serv_got_typing( gc, who, 5, 1 );
     686                                serv_got_typing( ic, who, 5, 1 );
    687687                                g_free( who );
    688688                        }
Note: See TracChangeset for help on using the changeset viewer.