diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-11-21 15:23:54 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-11-21 15:23:54 +0000 |
commit | 748bcdde269da5cd8184418f0df334e12338a541 (patch) | |
tree | 5e046d6d0426872666722ceab8b04e48296f8360 /protocols/account.c | |
parent | bb151f7aad467bf29c6e5ca552088f7f0b8ec876 (diff) |
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.
Diffstat (limited to 'protocols/account.c')
-rw-r--r-- | protocols/account.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/protocols/account.c b/protocols/account.c index 50b7be8e..819bdc10 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -338,6 +338,8 @@ void account_del( bee_t *bee, account_t *acc ) } } +static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond ); + void account_on( bee_t *bee, account_t *a ) { if( a->ic ) @@ -350,6 +352,9 @@ void account_on( bee_t *bee, account_t *a ) a->reconnect = 0; a->prpl->login( a ); + + if( !( a->ic->flags & OPT_SLOW_LOGIN ) ) + a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic ); } void account_off( bee_t *bee, account_t *a ) @@ -363,6 +368,16 @@ void account_off( bee_t *bee, account_t *a ) } } +static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond ) +{ + struct im_connection *ic = d; + + imcb_error( ic, "Connection timeout" ); + imc_logout( ic, TRUE ); + + return FALSE; +} + struct account_reconnect_delay { int start; |