X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/blobdiff_plain/b7891f5d621a37490844913a219b47b2feb23ea4..c8726ad2993d45e82b37ae846310181d4200e5ed:/twirssi.pl diff --git a/twirssi.pl b/twirssi.pl index 5295231..0c433cd 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -8,11 +8,12 @@ use LWP::Simple; use Data::Dumper; use Encode; use POSIX qw/:sys_wait_h/; +use Net::Twitter qw/3.05/; $Data::Dumper::Indent = 1; use vars qw($VERSION %IRSSI); -$VERSION = "2.4.0beta"; +$VERSION = "2.4.1beta"; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@ -21,7 +22,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; @@ -509,18 +510,12 @@ sub cmd_login { } $defservice = $service = ucfirst lc $service; - print "Loading Net::$service" if &debug; - eval "use Net::$service 3.05"; - if ($@) { - ¬ice( - "Failed to load Net::$service when trying to log in as $user: $@"); - return; - } - - if ( Irssi::settings_get_bool("twirssi_use_oauth") ) { + if ( $service eq 'Twitter' and + Irssi::settings_get_bool("twirssi_use_oauth") ) { print "Attempting OAuth for $user\@$service" if &debug; eval { - $twit = "Net::$service"->new( + $twit = Net::Twitter->new( + $service eq 'Identica' ? ( identica => 1 ) : (), traits => [ 'API::REST', 'OAuth' ], consumer_key => 'BZVAvBma4GxdiRwXIvbnw', consumer_secret => '0T5kahwLyb34vciGZsgkA9lsjtGCQ05vxVE2APXM', @@ -543,8 +538,9 @@ sub cmd_login { } unless ( $twit->authorized ) { + my $url; eval { - my $url = $twit->get_authorization_url; + $url = $twit->get_authorization_url; }; if ($@) { @@ -562,7 +558,8 @@ sub cmd_login { } } } else { - $twit = "Net::$service"->new( + $twit = Net::Twitter->new( + $service eq 'Identica' ? ( identica => 1 ) : (), username => $user, password => $pass, source => "twirssi", @@ -571,7 +568,7 @@ sub cmd_login { } unless ($twit) { - ¬ice("Failed to create Net::$service object! Aborting."); + ¬ice("Failed to create object! Aborting."); return; }