Ignore:
Timestamp:
2010-07-11T17:21:21Z (14 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
be999a5
Parents:
3759849 (diff), 00540d4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with upstraem bitlbee 1.2.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r3759849 reb6df6a  
    4040                return 0;
    4141
    42         // If the user uses multiple private message windows we need to get the
    43         // users buddies.
    44         if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "many") == 0)
    45                 twitter_get_statuses_friends(ic, -1);
    46 
    4742        // Do stuff..
    4843        twitter_get_home_timeline(ic, -1);
     
    5651        struct twitter_data *td = ic->proto_data;
    5752       
    58         imcb_log( ic, "Connecting to Twitter" );
     53        imcb_log( ic, "Getting initial statuses" );
    5954
    6055        // Run this once. After this queue the main loop function.
     
    6661}
    6762
     63static void twitter_oauth_start( struct im_connection *ic );
     64
     65void twitter_login_finish( struct im_connection *ic )
     66{
     67        struct twitter_data *td = ic->proto_data;
     68       
     69        if( set_getbool( &ic->acc->set, "oauth" ) && !td->oauth_info )
     70                twitter_oauth_start( ic );
     71        else if( g_strcasecmp( set_getstr( &ic->acc->set, "mode" ), "one" ) != 0 &&
     72                 !( td->flags & TWITTER_HAVE_FRIENDS ) )
     73        {
     74                imcb_log( ic, "Getting contact list" );
     75                twitter_get_statuses_friends( ic, -1 );
     76        }
     77        else
     78                twitter_main_loop_start( ic );
     79}
    6880
    6981static const struct oauth_service twitter_oauth =
     
    128140                ic->acc->pass = oauth_to_string( info );
    129141               
    130                 twitter_main_loop_start( ic );
     142                twitter_login_finish( ic );
    131143        }
    132144       
     
    211223        imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL );
    212224       
    213         if( td->oauth_info || !set_getbool( &acc->set, "oauth" ) )
    214                 twitter_main_loop_start( ic );
    215         else
    216                 twitter_oauth_start( ic );
     225        imcb_log( ic, "Connecting" );
     226       
     227        twitter_login_finish( ic );
    217228}
    218229
     
    236247        {
    237248                oauth_info_free( td->oauth_info );
     249                g_free( td->url_host );
     250                g_free( td->url_path );
    238251                g_free( td->pass );
    239252                g_free( td );
     
    256269                    td->oauth_info && td->oauth_info->token == NULL )
    257270                {
    258                         if( !oauth_access_token( message, td->oauth_info ) )
     271                        char pin[strlen(message)+1], *s;
     272                       
     273                        strcpy( pin, message );
     274                        for( s = pin + sizeof( pin ) - 2; s > pin && isspace( *s ); s -- )
     275                                *s = '\0';
     276                        for( s = pin; *s && isspace( *s ); s ++ ) {}
     277                       
     278                        if( !oauth_access_token( s, td->oauth_info ) )
    259279                        {
    260280                                imcb_error( ic, "OAuth error: %s", "Failed to send access token request" );
Note: See TracChangeset for help on using the changeset viewer.