From: Dan Boger Date: Wed, 12 Aug 2009 23:56:34 +0000 (-0700) Subject: Add new setting - twitter_timeout, defaults to 30 seconds. Requests that take longer... X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/commitdiff_plain/4edf2cd46af41132f0235069bb4c03b09c1a24ca?hp=e3f196ec3b0278acf9601baeae997ab8218e7926 Add new setting - twitter_timeout, defaults to 30 seconds. Requests that take longer than this timeout should just fail (instead of causing irssi to ping out) --- diff --git a/twirssi.pl b/twirssi.pl index a52823f..331715c 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -499,6 +499,15 @@ sub cmd_login { ssl => Irssi::settings_get_bool("twirssi_avoid_ssl") ? 0 : 1, ); + unless ($twit) { + ¬ice("Failed to create Net::$service object! Aborting."); + return; + } + + if ( my $timeout = Irssi::settings_get_int("twitter_timeout") ) { + $twit->ua->timeout($timeout); + } + unless ( $twit->verify_credentials() ) { ¬ice("Login as $user\@$service failed"); $twit = undef; @@ -1511,6 +1520,7 @@ Irssi::settings_add_str( "twirssi", "twirssi_replies_store", ".irssi/scripts/twirssi.json" ); Irssi::settings_add_int( "twirssi", "twitter_friends_poll", 600 ); +Irssi::settings_add_int( "twirssi", "twitter_timeout", 30 ); Irssi::settings_add_bool( "twirssi", "twirssi_upgrade_beta", 0 ); Irssi::settings_add_bool( "twirssi", "tweet_to_away", 0 );