Changeset e6648bf for protocols/msn/ns.c


Ignore:
Timestamp:
2008-02-17T11:16:01Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9186d15
Parents:
4bbcba3
Message:

Replaced old MSN Passport (v1.4) authentication code with what's described on
http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener . This was an
attempt to fix bug #360, but it didn't. However, this change may make BitlBee
a little bit more future-proof. Plus, the code is tidier and sometimes faster
than the old mechanism.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    r4bbcba3 re6648bf  
    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 )
     
    214214                {
    215215                        /* Time for some Passport black magic... */
    216                         if( !passport_get_id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )
     216                        if( !passport_get_token( msn_auth_got_passport_token, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )
    217217                        {
    218218                                imcb_error( ic, "Error while contacting Passport server" );
     
    674674}
    675675
    676 static void msn_auth_got_passport_id( struct passport_reply *rep )
     676static void msn_auth_got_passport_token( struct msn_auth_data *mad )
    677677{
    678         struct im_connection *ic = rep->data;
    679         struct msn_data *md = ic->proto_data;
    680         char *key = rep->result;
    681         char buf[1024];
    682        
    683         if( key == NULL )
    684         {
    685                 imcb_error( ic, "Error during Passport authentication (%s)",
    686                                rep->error_string ? rep->error_string : "Unknown error" );
     678        struct im_connection *ic = mad->data;
     679        struct msn_data *md;
     680       
     681        /* Dead connection? */
     682        if( g_slist_find( msn_connections, ic ) == NULL )
     683                return;
     684       
     685        md = ic->proto_data;
     686        if( mad->token )
     687        {
     688                char buf[1024];
     689               
     690                g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token );
     691                msn_write( ic, buf, strlen( buf ) );
     692        }
     693        else
     694        {
     695                imcb_error( ic, "Error during Passport authentication: %s", mad->error );
    687696                imc_logout( ic, TRUE );
    688697        }
    689         else
    690         {
    691                 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );
    692                 msn_write( ic, buf, strlen( buf ) );
    693         }
    694698}
Note: See TracChangeset for help on using the changeset viewer.