X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/blobdiff_plain/89061e3ad9db4185d5589f91a05a0bad234f0a72..513c0f327b89522e72c12c14b205fbb5d87c4e0b:/twirssi.pl diff --git a/twirssi.pl b/twirssi.pl index 5234372..9cbf2ff 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -12,7 +12,7 @@ $Data::Dumper::Indent = 1; use vars qw($VERSION %IRSSI); -$VERSION = "2.4.0beta"; +$VERSION = "2.4.0"; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@ -21,7 +21,7 @@ $VERSION = "2.4.0beta"; . 'Can optionally set your bitlbee /away message to same', license => 'GNU GPL v2', url => 'http://twirssi.com', - changed => '$Date: 2009-08-07 01:24:53 -0700 (Fri, 07 Aug 2009) $', + changed => 'Fri Jan 22 14:40:48 PST 2010', ); my $window; @@ -430,7 +430,9 @@ sub cmd_logout { return unless $data = &valid_username($data); ¬ice("Logging out $data..."); - $twits{$data}->end_session(); + eval { + $twits{$data}->end_session(); + }; delete $twits{$data}; undef $twit; if ( keys %twits ) { @@ -541,10 +543,20 @@ sub cmd_login { } unless ( $twit->authorized ) { + my $url; + eval { + $url = $twit->get_authorization_url; + }; + + if ($@) { + ¬ice("ERROR: Failed to get OAuth authorization_url. Try again later."); + return; + } + ¬ice("Twirssi not autorized to access $service for $user."); ¬ice("Please authorize at the following url, then enter the pin "); ¬ice("supplied with /twirssi_oauth $user\@$service "); - ¬ice($twit->get_authorization_url); + ¬ice($url); $oauth{pending}{"$user\@$service"} = $twit; return; @@ -1043,11 +1055,13 @@ sub get_updates { sub do_updates { my ( $fh, $username, $obj, $cache ) = @_; - my $rate_limit = $obj->rate_limit_status(); - if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) { - ¬ice("Rate limit exceeded for $username"); - return undef; - } + eval { + my $rate_limit = $obj->rate_limit_status(); + if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) { + ¬ice("Rate limit exceeded for $username"); + return undef; + } + }; print scalar localtime, " - Polling for updates for $username" if &debug; my $tweets;