Changeset d84e2a9 for protocols/msn/ns.c


Ignore:
Timestamp:
2008-08-02T11:21:36Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
280e655
Parents:
e0798cc
Message:

Microsoft, I hate you.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    re0798cc rd84e2a9  
    3434static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts );
    3535
    36 static void msn_auth_got_passport_id( struct passport_reply *rep );
     36static void msn_auth_got_passport_token( struct msn_auth_data *mad );
    3737
    3838gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
     
    222222                {
    223223                        /* Time for some Passport black magic... */
    224                         if( !passport_get_id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )
     224                        if( !passport_get_token( msn_auth_got_passport_token, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )
    225225                        {
    226226                                imcb_error( ic, "Error while contacting Passport server" );
     
    709709}
    710710
    711 static void msn_auth_got_passport_id( struct passport_reply *rep )
     711static void msn_auth_got_passport_token( struct msn_auth_data *mad )
    712712{
    713         struct im_connection *ic = rep->data;
    714         struct msn_data *md = ic->proto_data;
    715         char *key = rep->result;
    716         char buf[1024];
    717        
    718         if( key == NULL )
    719         {
    720                 imcb_error( ic, "Error during Passport authentication (%s)",
    721                                rep->error_string ? rep->error_string : "Unknown error" );
     713        struct im_connection *ic = mad->data;
     714        struct msn_data *md;
     715       
     716        /* Dead connection? */
     717        if( g_slist_find( msn_connections, ic ) == NULL )
     718                return;
     719       
     720        md = ic->proto_data;
     721        if( mad->token )
     722        {
     723                char buf[1024];
     724               
     725                g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token );
     726                msn_write( ic, buf, strlen( buf ) );
     727        }
     728        else
     729        {
     730                imcb_error( ic, "Error during Passport authentication: %s", mad->error );
    722731                imc_logout( ic, TRUE );
    723732        }
    724         else
    725         {
    726                 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );
    727                 msn_write( ic, buf, strlen( buf ) );
    728         }
    729733}
Note: See TracChangeset for help on using the changeset viewer.