Changeset 748bcdd


Ignore:
Timestamp:
2010-11-21T15:23:54Z (10 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
495d21b
Parents:
bb151f7
Message:

Time out if logging in takes too long (2m for now). Except for Twitter
OAuth login, which requires user action. This mostly solves problems with
OSCAR login silently failing, but may also be useful in other places.

Location:
protocols
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/account.c

    rbb151f7 r748bcdd  
    339339}
    340340
     341static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond );
     342
    341343void account_on( bee_t *bee, account_t *a )
    342344{
     
    351353        a->reconnect = 0;
    352354        a->prpl->login( a );
     355       
     356        if( !( a->ic->flags & OPT_SLOW_LOGIN ) )
     357                a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic );
    353358}
    354359
     
    362367                cancel_auto_reconnect( a );
    363368        }
     369}
     370
     371static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond )
     372{
     373        struct im_connection *ic = d;
     374       
     375        imcb_error( ic, "Connection timeout" );
     376        imc_logout( ic, TRUE );
     377       
     378        return FALSE;
    364379}
    365380
  • protocols/nogaim.c

    rbb151f7 r748bcdd  
    277277        imcb_log( ic, "Logged in" );
    278278       
     279        b_event_remove( ic->keepalive );
    279280        ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );
    280281        ic->flags |= OPT_LOGGED_IN;
  • protocols/nogaim.h

    rbb151f7 r748bcdd  
    6464#define OPT_DOES_HTML   0x00000010
    6565#define OPT_LOCALBUDDY  0x00000020 /* For nicks local to one groupchat */
     66#define OPT_SLOW_LOGIN  0x00000040 /* I.e. Twitter Oauth @ login time */
    6667#define OPT_TYPING      0x00000100 /* Some pieces of code make assumptions */
    6768#define OPT_THINKING    0x00000200 /* about these values... Stupid me! */
  • protocols/twitter/twitter.c

    rbb151f7 r748bcdd  
    108108
    109109        td->oauth_info = oauth_request_token( &twitter_oauth, twitter_oauth_callback, ic );
     110       
     111        /* We need help from the user to complete OAuth login, so don't time
     112           out on this login. */
     113        ic->flags |= OPT_SLOW_LOGIN;
    110114}
    111115
Note: See TracChangeset for help on using the changeset viewer.