10 $Data::Dumper::Indent = 1;
12 use vars qw($VERSION %IRSSI);
14 $VERSION = "2.3.1beta";
16 authors => 'Dan Boger',
17 contact => 'zigdon@gmail.com',
19 description => 'Send twitter updates using /tweet. '
20 . 'Can optionally set your bitlbee /away message to same',
21 license => 'GNU GPL v2',
22 url => 'http://twirssi.com',
23 changed => '$Date: 2009-08-07 01:24:53 -0700 (Fri, 07 Aug 2009) $',
33 my $last_friends_poll = 0;
41 my %fix_replies_index;
43 my %irssi_to_mirc_colors = (
63 my ( $data, $server, $win ) = @_;
65 return unless &logged_in($twit);
67 my ( $target, $text ) = split ' ', $data, 2;
68 unless ( $target and $text ) {
69 ¬ice("Usage: /dm <nick> <message>");
73 &cmd_direct_as( "$user $data", $server, $win );
77 my ( $data, $server, $win ) = @_;
79 return unless &logged_in($twit);
81 my ( $username, $target, $text ) = split ' ', $data, 3;
82 unless ( $username and $target and $text ) {
83 ¬ice("Usage: /dm_as <username> <nick> <message>");
87 return unless $username = &valid_username($username);
90 if ( $twits{$username}
91 ->new_direct_message( { user => $target, text => $text } ) )
93 ¬ice("DM sent to $target: $text");
94 $nicks{$target} = time;
98 $error = JSON::Any->jsonToObj( $twits{$username}->get_error() );
99 $error = $error->{error};
101 die $error if $error;
102 ¬ice("DM to $target failed");
107 ¬ice("DM caused an error: $@");
113 my ( $data, $server, $win ) = @_;
115 return unless &logged_in($twit);
117 $data =~ s/^\s+|\s+$//;
119 ¬ice("Usage: /retweet <nick[:num]> [comment]");
123 my ( $id, $data ) = split ' ', $data, 2;
125 &cmd_retweet_as( "$user $id $data", $server, $win );
129 my ( $data, $server, $win ) = @_;
131 unless ( Irssi::settings_get_bool("twirssi_track_replies") ) {
132 ¬ice("twirssi_track_replies is required in order to reteet.");
136 return unless &logged_in($twit);
138 $data =~ s/^\s+|\s+$//;
139 my ( $username, $id, $data ) = split ' ', $data, 3;
142 ¬ice("Usage: /retweet_as <username> <nick[:num]> [comment]");
146 return unless $username = &valid_username($username);
149 $id =~ s/[^\w\d\-:]+//g;
150 ( $nick, $id ) = split /:/, $id;
151 unless ( exists $id_map{ lc $nick } ) {
152 ¬ice("Can't find a tweet from $nick to retweet!");
156 $id = $id_map{__indexes}{$nick} unless $id;
157 unless ( $id_map{ lc $nick }[$id] ) {
158 ¬ice("Can't find a tweet numbered $id from $nick to retweet!");
162 unless ( $id_map{__tweets}{ lc $nick }[$id] ) {
163 ¬ice("The text of this tweet isn't saved, sorry!");
167 # Irssi::settings_add_str( "twirssi", "twirssi_retweet_format", 'RT $n: $t ${-- $c$}' );
168 my $text = Irssi::settings_get_str("twirssi_retweet_format");
169 $text =~ s/\$n/\@$nick/g;
171 $text =~ s/\${|\$}//g;
172 $text =~ s/\$c/$data/;
174 $text =~ s/\${.*?\$}//;
176 $text =~ s/\$t/$id_map{__tweets}{ lc $nick }[$id]/;
178 $data = &shorten($text);
180 return if &too_long($data);
185 $twits{$username}->update(
189 # in_reply_to_status_id => $id_map{ lc $nick }[$id]
194 ¬ice("Update failed");
198 return unless $success;
201 ¬ice("Update caused an error: $@. Aborted");
205 foreach ( $data =~ /@([-\w]+)/ ) {
209 ¬ice("Retweet sent");
213 my ( $data, $server, $win ) = @_;
215 return unless &logged_in($twit);
217 $data =~ s/^\s+|\s+$//;
219 ¬ice("Usage: /tweet <update>");
223 &cmd_tweet_as( "$user\@$defservice $data", $server, $win );
227 my ( $data, $server, $win ) = @_;
229 return unless &logged_in($twit);
231 $data =~ s/^\s+|\s+$//;
232 $data =~ s/\s\s+/ /g;
233 my ( $username, $data ) = split ' ', $data, 2;
235 unless ( $username and $data ) {
236 ¬ice("Usage: /tweet_as <username> <update>");
240 return unless $username = &valid_username($username);
242 $data = &shorten($data);
244 return if &too_long($data);
248 unless ( $twits{$username}->update($data) )
250 ¬ice("Update failed");
254 return unless $success;
257 ¬ice("Update caused an error: $@. Aborted.");
261 foreach ( $data =~ /@([-\w]+)/ ) {
265 my $away = &update_away($data);
267 ¬ice( "Update sent" . ( $away ? " (and away msg set)" : "" ) );
271 my ( $data, $server, $win ) = @_;
273 return unless &logged_in($twit);
275 $data =~ s/^\s+|\s+$//;
277 ¬ice("Usage: /reply <nick[:num]> <update>");
281 my ( $id, $data ) = split ' ', $data, 2;
282 unless ( $id and $data ) {
283 ¬ice("Usage: /reply <nick[:num]> <update>");
287 &cmd_reply_as( "$user $id $data", $server, $win );
291 my ( $data, $server, $win ) = @_;
293 unless ( Irssi::settings_get_bool("twirssi_track_replies") ) {
294 ¬ice("twirssi_track_replies is required in order to reply to "
295 . "specific tweets. Either enable it, or just use /tweet "
296 . "\@username <text>." );
300 return unless &logged_in($twit);
302 $data =~ s/^\s+|\s+$//;
303 my ( $username, $id, $data ) = split ' ', $data, 3;
305 unless ( $username and $data ) {
306 ¬ice("Usage: /reply_as <username> <nick[:num]> <update>");
310 return unless $username = &valid_username($username);
313 $id =~ s/[^\w\d\-:]+//g;
314 ( $nick, $id ) = split /:/, $id;
315 unless ( exists $id_map{ lc $nick } ) {
316 ¬ice("Can't find a tweet from $nick to reply to!");
320 $id = $id_map{__indexes}{$nick} unless $id;
321 unless ( $id_map{ lc $nick }[$id] ) {
322 ¬ice("Can't find a tweet numbered $id from $nick to reply to!");
326 if ( Irssi::settings_get_bool("twirssi_replies_autonick") ) {
328 # remove any @nick at the beginning of the reply, as we'll add it anyway
329 $data =~ s/^\s*\@?$nick\s*//;
330 $data = "\@$nick " . $data;
333 $data = &shorten($data);
335 return if &too_long($data);
340 $twits{$username}->update(
343 in_reply_to_status_id => $id_map{ lc $nick }[$id]
348 ¬ice("Update failed");
352 return unless $success;
355 ¬ice("Update caused an error: $@. Aborted");
359 foreach ( $data =~ /@([-\w]+)/ ) {
363 my $away = &update_away($data);
365 ¬ice( "Update sent" . ( $away ? " (and away msg set)" : "" ) );
369 my ( $usage_str, $api_name, $post_ref ) = @_;
372 my ( $data, $server, $win ) = @_;
374 return unless &logged_in($twit);
376 $data =~ s/^\s+|\s+$//;
378 ¬ice("Usage: $usage_str");
384 unless ( $twit->$api_name($data) )
386 ¬ice("$api_name failed");
390 return unless $success;
393 ¬ice("$api_name caused an error. Aborted.");
397 &$post_ref($data) if $post_ref;
402 my ( $data, $server, $win ) = @_;
404 $data =~ s/^\s+|\s+$//g;
405 $data = &normalize_username($data);
406 if ( exists $twits{$data} ) {
407 ¬ice("Switching to $data");
408 $twit = $twits{$data};
409 if ( $data =~ /(.*)\@(.*)/ ) {
413 ¬ice("Couldn't figure out what service '$data' is on");
416 ¬ice("Unknown user $data");
421 my ( $data, $server, $win ) = @_;
423 $data =~ s/^\s+|\s+$//g;
424 $data = $user unless $data;
425 return unless $data = &valid_username($data);
427 ¬ice("Logging out $data...");
428 $twits{$data}->end_session();
429 delete $twits{$data};
432 &cmd_switch( ( keys %twits )[0], $server, $win );
434 Irssi::timeout_remove($poll) if $poll;
440 my ( $data, $server, $win ) = @_;
443 ( $user, $pass ) = split ' ', $data, 2;
445 ¬ice("usage: /twitter_login <username>[\@<service>] <password>");
448 } elsif ( my $autouser = Irssi::settings_get_str("twitter_usernames")
449 and my $autopass = Irssi::settings_get_str("twitter_passwords") )
451 my @user = split /\s*,\s*/, $autouser;
452 my @pass = split /\s*,\s*/, $autopass;
454 # if a password ends with a '\', it was meant to escape the comma, and
455 # it should be concatinated with the next one
459 while ( $p =~ /\\$/ and @pass ) {
460 $p .= "," . shift @pass;
465 if ( @user != @unescaped ) {
466 ¬ice("Number of usernames doesn't match "
467 . "the number of passwords - auto-login failed" );
470 while ( @user and @unescaped ) {
472 $p = shift @unescaped;
478 ¬ice("/twitter_login requires either a username and password "
479 . "or twitter_usernames and twitter_passwords to be set." );
483 %friends = %nicks = ();
486 if ( $user =~ /^(.*)@(twitter|identica)$/ ) {
487 ( $user, $service ) = ( $1, $2 );
489 $service = Irssi::settings_get_str("twirssi_default_service");
491 $defservice = $service = ucfirst lc $service;
493 eval "use Net::$service 3.0";
496 "Failed to load Net::$service when trying to log in as $user: $@");
500 $twit = "Net::$service"->new(
504 ssl => Irssi::settings_get_bool("twirssi_avoid_ssl") ? 0 : 1,
508 ¬ice("Failed to create Net::$service object! Aborting.");
512 if ( my $timeout = Irssi::settings_get_int("twitter_timeout")
513 and $twit->can('ua') )
515 $twit->ua->timeout($timeout);
518 unless ( $twit->verify_credentials() ) {
519 ¬ice("Login as $user\@$service failed");
521 if ( not Irssi::settings_get_bool("twirssi_avoid_ssl") ) {
523 "It's possible you're missing one of the modules required for "
524 . "SSL logins. Try setting twirssi_avoid_ssl to on. See "
525 . "http://cpansearch.perl.org/src/GAAS/libwww-perl-5.831/README.SSL "
526 . "for the detailed requirements." );
531 &cmd_switch( ( keys %twits )[0], $server, $win );
537 my $rate_limit = $twit->rate_limit_status();
538 if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
540 "Rate limit exceeded, try again after $rate_limit->{reset_time}"
546 $twits{"$user\@$service"} = $twit;
547 Irssi::timeout_remove($poll) if $poll;
548 $poll = Irssi::timeout_add( &get_poll_time * 1000, \&get_updates, "" );
549 ¬ice("Logged in as $user\@$service, loading friends list...");
551 ¬ice( "loaded friends: ", scalar keys %friends );
552 if ( Irssi::settings_get_bool("twirssi_first_run") ) {
553 Irssi::settings_set_bool( "twirssi_first_run", 0 );
559 ¬ice("Login failed");
564 my ( $data, $server, $win ) = @_;
567 ¬ice("Usage: /twitter_add_follow_extra <username>");
571 $data =~ s/^\s+|\s+$//;
575 if ( exists $id_map{__fixreplies}{"$user\@$defservice"}{$data} ) {
576 ¬ice("Already following all replies by \@$data");
580 $id_map{__fixreplies}{"$user\@$defservice"}{$data} = 1;
581 ¬ice("Will now follow all replies by \@$data");
585 my ( $data, $server, $win ) = @_;
588 ¬ice("Usage: /twitter_del_follow_extra <username>");
592 $data =~ s/^\s+|\s+$//;
596 unless ( exists $id_map{__fixreplies}{"$user\@$defservice"}{$data} ) {
597 ¬ice("Wasn't following all replies by \@$data");
601 delete $id_map{__fixreplies}{"$user\@$defservice"}{$data};
602 ¬ice("Will no longer follow all replies by \@$data");
605 sub cmd_list_follow {
606 my ( $data, $server, $win ) = @_;
609 foreach my $suser ( sort keys %{ $id_map{__fixreplies} } ) {
611 foreach my $fruser ( sort keys %{ $id_map{__fixreplies}{$suser} } ) {
612 $frusers = $frusers ? "$frusers, $fruser" : $fruser;
616 ¬ice("Following all replies as \@$suser: $frusers");
621 ¬ice("Not following all replies by anyone");
626 my ( $data, $server, $win ) = @_;
628 unless ( $twit and $twit->can('search') ) {
629 ¬ice("ERROR: Your version of Net::Twitter ($Net::Twitter::VERSION) "
630 . "doesn't support searches." );
634 $data =~ s/^\s+|\s+$//;
638 ¬ice("Usage: /twitter_subscribe <topic>");
642 if ( exists $id_map{__searches}{"$user\@$defservice"}{$data} ) {
643 ¬ice("Already had a subscription for '$data'");
647 $id_map{__searches}{"$user\@$defservice"}{$data} = 1;
648 ¬ice("Added subscription for '$data'");
652 my ( $data, $server, $win ) = @_;
654 unless ( $twit and $twit->can('search') ) {
655 ¬ice("ERROR: Your version of Net::Twitter ($Net::Twitter::VERSION) "
656 . "doesn't support searches." );
659 $data =~ s/^\s+|\s+$//;
663 ¬ice("Usage: /twitter_unsubscribe <topic>");
667 unless ( exists $id_map{__searches}{"$user\@$defservice"}{$data} ) {
668 ¬ice("No subscription found for '$data'");
672 delete $id_map{__searches}{"$user\@$defservice"}{$data};
673 ¬ice("Removed subscription for '$data'");
676 sub cmd_list_search {
677 my ( $data, $server, $win ) = @_;
680 foreach my $suser ( sort keys %{ $id_map{__searches} } ) {
682 foreach my $topic ( sort keys %{ $id_map{__searches}{$suser} } ) {
683 $topics = $topics ? "$topics, $topic" : $topic;
687 ¬ice("Search subscriptions for \@$suser: $topics");
692 ¬ice("No search subscriptions set up");
697 my ( $data, $server, $win ) = @_;
699 my $loc = Irssi::settings_get_str("twirssi_location");
701 ¬ice("$loc isn't writable, can't upgrade."
702 . " Perhaps you need to /set twirssi_location?" );
707 unless ( $data or Irssi::settings_get_bool("twirssi_upgrade_beta") ) {
708 eval { use Digest::MD5; };
711 ¬ice("Failed to load Digest::MD5."
712 . " Try '/twirssi_upgrade nomd5' to skip MD5 verification" );
716 $md5 = get("http://twirssi.com/md5sum");
720 ¬ice("Failed to download md5sum from peeron! Aborting.");
724 unless ( open( CUR, $loc ) ) {
725 ¬ice("Failed to read $loc."
726 . " Check that /set twirssi_location is set to the correct location."
731 my $cur_md5 = Digest::MD5::md5_hex(<CUR>);
734 if ( $cur_md5 eq $md5 ) {
735 ¬ice("Current twirssi seems to be up to date.");
741 Irssi::settings_get_bool("twirssi_upgrade_beta")
742 ? "http://github.com/zigdon/twirssi/raw/master/twirssi.pl"
743 : "http://twirssi.com/twirssi.pl";
744 ¬ice("Downloading twirssi from $URL");
745 LWP::Simple::getstore( $URL, "$loc.upgrade" );
747 unless ( -s "$loc.upgrade" ) {
748 ¬ice("Failed to save $loc.upgrade."
749 . " Check that /set twirssi_location is set to the correct location."
754 unless ( $data or Irssi::settings_get_bool("twirssi_upgrade_beta") ) {
755 unless ( open( NEW, "$loc.upgrade" ) ) {
756 ¬ice("Failed to read $loc.upgrade."
757 . " Check that /set twirssi_location is set to the correct location."
762 my $new_md5 = Digest::MD5::md5_hex(<NEW>);
765 if ( $new_md5 ne $md5 ) {
766 ¬ice("MD5 verification failed. expected $md5, got $new_md5");
771 rename $loc, "$loc.backup"
772 or ¬ice("Failed to back up $loc: $!. Aborting")
774 rename "$loc.upgrade", $loc
775 or ¬ice("Failed to rename $loc.upgrade: $!. Aborting")
778 my ( $dir, $file ) = ( $loc =~ m{(.*)/([^/]+)$} );
779 if ( -e "$dir/autorun/$file" ) {
780 ¬ice("Updating $dir/autorun/$file");
781 unlink "$dir/autorun/$file"
782 or ¬ice("Failed to remove old $file from autorun: $!");
783 symlink "../$file", "$dir/autorun/$file"
784 or ¬ice("Failed to create symlink in autorun directory: $!");
787 ¬ice("Download complete. Reload twirssi with /script load $file");
796 while ( $page < 11 and $cursor ne "0" )
798 print $fh "type:debug Loading friends page $page...\n"
799 if ( $fh and &debug );
801 if ( ref $twit =~ /^Net::Twitter/ ) {
802 $friends = $twit->friends( { cursor => $cursor } );
803 last unless $friends;
804 $cursor = $friends->{next_cursor};
805 $friends = $friends->{users};
807 $friends = $twit->friends( { page => $page } );
808 last unless $friends;
810 $new_friends{ $_->{screen_name} } = time foreach @$friends;
816 print $fh "type:debug Error during friends list update. Aborted.\n";
820 my ( $added, $removed ) = ( 0, 0 );
821 print $fh "type:debug Scanning for new friends...\n" if ( $fh and &debug );
822 foreach ( keys %new_friends ) {
823 next if exists $friends{$_};
828 print $fh "type:debug Scanning for removed friends...\n"
829 if ( $fh and &debug );
830 foreach ( keys %friends ) {
831 next if exists $new_friends{$_};
836 return ( $added, $removed );
840 print scalar localtime, " - get_updates starting" if &debug;
843 Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
846 ->print( "Can't find a window named '"
847 . Irssi::settings_get_str('twitter_window')
848 . "'. Create it or change the value of twitter_window" );
851 return unless &logged_in($twit);
853 my ( $fh, $filename ) = File::Temp::tempfile();
854 binmode( $fh, ":utf8" );
857 if ($child_pid) { # parent
858 Irssi::timeout_add_once( 5000, 'monitor_child',
859 [ "$filename.done", 0 ] );
860 Irssi::pidwait_add($child_pid);
861 } elsif ( defined $child_pid ) { # child
870 foreach ( keys %twits ) {
871 $error++ unless &do_updates( $fh, $_, $twits{$_}, \%context_cache );
873 if ( $id_map{__fixreplies}{$_} ) {
874 my @frusers = sort keys %{ $id_map{__fixreplies}{$_} };
877 unless &get_timeline( $fh, $frusers[ $fix_replies_index{$_} ],
878 $_, $twits{$_}, \%context_cache );
880 $fix_replies_index{$_}++;
881 $fix_replies_index{$_} = 0
882 if $fix_replies_index{$_} >= @frusers;
883 print $fh "id:$fix_replies_index{$_} ",
884 "account:$_ type:fix_replies_index\n";
888 print $fh "__friends__\n";
890 time - $last_friends_poll >
891 Irssi::settings_get_int('twitter_friends_poll') )
893 print $fh "__updated ", time, "\n";
894 my ( $added, $removed ) = &load_friends($fh);
895 if ( $added + $removed ) {
896 print $fh "type:debug %R***%n Friends list updated: ",
898 sprintf( "%d added", $added ),
899 sprintf( "%d removed", $removed ) ),
904 foreach ( sort keys %friends ) {
905 print $fh "$_ $friends{$_}\n";
909 print $fh "type:debug Update encountered errors. Aborted\n";
910 print $fh "-- $last_poll";
912 print $fh "-- $new_poll";
915 rename $filename, "$filename.done";
918 &ccrap("Failed to fork for updating: $!");
920 print scalar localtime, " - get_updates ends" if &debug;
924 my ( $fh, $username, $obj, $cache ) = @_;
926 my $rate_limit = $obj->rate_limit_status();
927 if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
928 ¬ice("Rate limit exceeded for $username");
932 print scalar localtime, " - Polling for updates for $username" if &debug;
936 if ( $id_map{__last_id}{$username}{timeline} )
938 $tweets = $obj->friends_timeline( { count => 100 } );
940 $tweets = $obj->friends_timeline();
945 print $fh "type:debug Error during friends_timeline call: Aborted.\n";
946 print $fh "type:debug : $_\n" foreach split /\n/, Dumper($@);
950 unless ( ref $tweets ) {
951 if ( $obj->can("get_error") ) {
952 my $error = "Unknown error";
953 eval { $error = JSON::Any->jsonToObj( $obj->get_error() ) };
954 unless ($@) { $error = $obj->get_error() }
956 "type:debug API Error during friends_timeline call: Aborted\n";
957 print $fh "type:debug : $_\n" foreach split /\n/, Dumper($error);
961 "type:debug API Error during friends_timeline call. Aborted.\n";
966 foreach my $t ( reverse @$tweets ) {
967 my $text = decode_entities( $t->{text} );
968 $text =~ s/[\n\r]/ /g;
970 if ( Irssi::settings_get_bool("show_reply_context")
971 and $t->{in_reply_to_screen_name} ne $username
972 and $t->{in_reply_to_screen_name}
973 and not exists $friends{ $t->{in_reply_to_screen_name} } )
975 $nicks{ $t->{in_reply_to_screen_name} } = time;
977 unless ( $cache->{ $t->{in_reply_to_status_id} } ) {
979 $cache->{ $t->{in_reply_to_status_id} } =
980 $obj->show_status( $t->{in_reply_to_status_id} );
984 $context = $cache->{ $t->{in_reply_to_status_id} };
987 my $ctext = decode_entities( $context->{text} );
988 $ctext =~ s/[\n\r]/ /g;
989 if ( $context->{truncated} and ref($obj) ne 'Net::Identica' ) {
991 " -- http://twitter.com/$context->{user}{screen_name}"
992 . "/status/$context->{id}";
994 printf $fh "id:%s account:%s nick:%s type:tweet %s\n",
995 $context->{id}, $username,
996 $context->{user}{screen_name}, $ctext;
1001 if $t->{user}{screen_name} eq $username
1002 and not Irssi::settings_get_bool("show_own_tweets");
1003 if ( $t->{truncated} and ref($obj) ne 'Net::Identica' ) {
1004 $text .= " -- http://twitter.com/$t->{user}{screen_name}"
1005 . "/status/$t->{id}";
1007 printf $fh "id:%s account:%s nick:%s type:%s %s\n",
1008 $t->{id}, $username, $t->{user}{screen_name}, $reply, $text;
1009 $new_poll_id = $t->{id} if $new_poll_id < $t->{id};
1011 printf $fh "id:%s account:%s type:last_id timeline\n",
1012 $new_poll_id, $username;
1014 print scalar localtime, " - Polling for replies since ",
1015 $id_map{__last_id}{$username}{reply}
1019 if ( $id_map{__last_id}{$username}{reply} )
1021 $tweets = $obj->replies(
1022 { since_id => $id_map{__last_id}{$username}{reply} } )
1025 $tweets = $obj->replies() || [];
1030 print $fh "type:debug Error during replies call. Aborted.\n";
1034 foreach my $t ( reverse @$tweets ) {
1036 if exists $friends{ $t->{user}{screen_name} };
1038 my $text = decode_entities( $t->{text} );
1039 $text =~ s/[\n\r]/ /g;
1040 if ( $t->{truncated} ) {
1041 $text .= " -- http://twitter.com/$t->{user}{screen_name}"
1042 . "/status/$t->{id}";
1044 printf $fh "id:%s account:%s nick:%s type:tweet %s\n",
1045 $t->{id}, $username, $t->{user}{screen_name}, $text;
1046 $new_poll_id = $t->{id} if $new_poll_id < $t->{id};
1048 printf $fh "id:%s account:%s type:last_id reply\n", $new_poll_id, $username;
1050 print scalar localtime, " - Polling for DMs" if &debug;
1053 if ( $id_map{__last_id}{$username}{dm} )
1055 $tweets = $obj->direct_messages(
1056 { since_id => $id_map{__last_id}{$username}{dm} } )
1059 $tweets = $obj->direct_messages() || [];
1064 print $fh "type:debug Error during direct_messages call. Aborted.\n";
1068 foreach my $t ( reverse @$tweets ) {
1069 my $text = decode_entities( $t->{text} );
1070 $text =~ s/[\n\r]/ /g;
1071 printf $fh "id:%s account:%s nick:%s type:dm %s\n",
1072 $t->{id}, $username, $t->{sender_screen_name}, $text;
1073 $new_poll_id = $t->{id} if $new_poll_id < $t->{id};
1075 printf $fh "id:%s account:%s type:last_id dm\n", $new_poll_id, $username;
1077 print scalar localtime, " - Polling for subscriptions" if &debug;
1078 if ( $obj->can('search') and $id_map{__searches}{$username} ) {
1080 foreach my $topic ( sort keys %{ $id_map{__searches}{$username} } ) {
1081 print $fh "type:debug searching for $topic since ",
1082 "$id_map{__searches}{$username}{$topic}\n";
1084 $search = $obj->search(
1087 since_id => $id_map{__searches}{$username}{$topic}
1094 "type:debug Error during search($topic) call. Aborted.\n";
1098 unless ( $search->{max_id} ) {
1099 print $fh "type:debug Invalid search results when searching",
1100 " for $topic. Aborted.\n";
1104 $id_map{__searches}{$username}{$topic} = $search->{max_id};
1105 printf $fh "id:%s account:%s type:searchid topic:%s\n",
1106 $search->{max_id}, $username, $topic;
1108 foreach my $t ( reverse @{ $search->{results} } ) {
1109 my $text = decode_entities( $t->{text} );
1110 $text =~ s/[\n\r]/ /g;
1111 printf $fh "id:%s account:%s nick:%s type:search topic:%s %s\n",
1112 $t->{id}, $username, $t->{from_user}, $topic, $text;
1113 $new_poll_id = $t->{id}
1115 or $t->{id} < $new_poll_id;
1120 print scalar localtime, " - Done" if &debug;
1126 my ( $fh, $target, $username, $obj, $cache ) = @_;
1128 my $last_id = $id_map{__last_id}{$username}{$target};
1130 print $fh "type:debug get_timeline("
1131 . "$fix_replies_index{$username}=$target > $last_id) started."
1132 . " username = $username\n";
1134 $tweets = $obj->user_timeline(
1137 ( $last_id ? ( since_id => $last_id ) : () ),
1144 "type:debug Error during user_timeline($target) call: Aborted.\n";
1145 print $fh "type:debug : $_\n" foreach split /\n/, Dumper($@);
1151 "type:debug user_timeline($target) call returned undef! Aborted\n";
1155 foreach my $t ( reverse @$tweets ) {
1156 my $text = decode_entities( $t->{text} );
1157 $text =~ s/[\n\r]/ /g;
1158 my $reply = "tweet";
1159 if ( Irssi::settings_get_bool("show_reply_context")
1160 and $t->{in_reply_to_screen_name} ne $username
1161 and $t->{in_reply_to_screen_name}
1162 and not exists $friends{ $t->{in_reply_to_screen_name} } )
1164 $nicks{ $t->{in_reply_to_screen_name} } = time;
1166 unless ( $cache->{ $t->{in_reply_to_status_id} } ) {
1168 $cache->{ $t->{in_reply_to_status_id} } =
1169 $obj->show_status( $t->{in_reply_to_status_id} );
1173 $context = $cache->{ $t->{in_reply_to_status_id} };
1176 my $ctext = decode_entities( $context->{text} );
1177 $ctext =~ s/[\n\r]/ /g;
1178 if ( $context->{truncated} and ref($obj) ne 'Net::Identica' ) {
1180 " -- http://twitter.com/$context->{user}{screen_name}"
1181 . "/status/$context->{id}";
1183 printf $fh "id:%s account:%s nick:%s type:tweet %s\n",
1184 $context->{id}, $username,
1185 $context->{user}{screen_name}, $ctext;
1189 if ( $t->{truncated} and ref($obj) ne 'Net::Identica' ) {
1190 $text .= " -- http://twitter.com/$t->{user}{screen_name}"
1191 . "/status/$t->{id}";
1193 printf $fh "id:%s account:%s nick:%s type:%s %s\n",
1194 $t->{id}, $username, $t->{user}{screen_name}, $reply, $text;
1195 $last_id = $t->{id} if $last_id < $t->{id};
1197 printf $fh "id:%s account:%s type:last_id_fixreplies %s\n",
1198 $last_id, $username, $target;
1205 my $filename = $data->[0];
1206 my $attempt = $data->[1];
1208 print scalar localtime, " - checking child log at $filename ($attempt)"
1210 my ($new_last_poll);
1212 # first time we run we don't want to print out *everything*, so we just
1215 if ( open FILE, $filename ) {
1216 binmode FILE, ":utf8";
1220 last if /^__friends__/;
1221 unless (/\n$/) { # skip partial lines
1222 # print "Skipping partial line: $_" if &debug;
1229 foreach my $key (qw/id account nick type topic/) {
1230 if (s/^$key:(\S+)\s*//) {
1235 if ( $meta{type} and $meta{type} eq 'fix_replies_index' ) {
1236 $fix_replies_index{ $meta{account} } = $meta{id};
1237 print "fix_replies_index for $meta{account} set to $meta{id}"
1242 if ( not $meta{type} or $meta{type} !~ /searchid|last_id/ ) {
1243 if ( exists $meta{id} and exists $new_cache{ $meta{id} } ) {
1247 $new_cache{ $meta{id} } = time;
1249 if ( exists $meta{id} and exists $tweet_cache{ $meta{id} } ) {
1255 $meta{account} =~ s/\@(\w+)$//;
1256 $meta{service} = $1;
1258 lc $meta{service} eq
1259 lc Irssi::settings_get_str("twirssi_default_service") )
1261 $account = "$meta{account}: "
1262 if lc "$meta{account}\@$meta{service}" ne lc
1263 "$user\@$defservice";
1265 $account = "$meta{account}\@$meta{service}: ";
1269 if ( $meta{type} ne 'dm'
1270 and Irssi::settings_get_bool("twirssi_track_replies")
1274 $marker = ( $id_map{__indexes}{ $meta{nick} } + 1 ) % 100;
1275 $id_map{ lc $meta{nick} }[$marker] = $meta{id};
1276 $id_map{__indexes}{ $meta{nick} } = $marker;
1277 $id_map{__tweets}{ lc $meta{nick} }[$marker] = $_;
1278 $marker = ":$marker";
1282 $irssi_to_mirc_colors{ Irssi::settings_get_str("hilight_color") };
1283 my $nick = "\@$meta{account}";
1284 if ( $_ =~ /\Q$nick\E(?:\W|$)/i
1285 and Irssi::settings_get_bool("twirssi_hilights") )
1287 $meta{nick} = "\cC$hilight_color$meta{nick}\cO";
1288 $hilight = MSGLEVEL_HILIGHT;
1291 if ( $meta{type} =~ /tweet|reply/ ) {
1294 ( MSGLEVEL_PUBLIC | $hilight ),
1295 $meta{type}, $account, $meta{nick}, $marker, $_
1297 } elsif ( $meta{type} eq 'search' ) {
1300 ( MSGLEVEL_PUBLIC | $hilight ),
1301 $meta{type}, $account, $meta{topic},
1302 $meta{nick}, $marker, $_
1305 exists $id_map{__searches}{ $meta{account} }{ $meta{topic} }
1307 $id_map{__searches}{ $meta{account} }{ $meta{topic} } )
1309 $id_map{__searches}{ $meta{account} }{ $meta{topic} } =
1312 } elsif ( $meta{type} eq 'dm' ) {
1315 ( MSGLEVEL_MSGS | $hilight ),
1316 $meta{type}, $account, $meta{nick}, $_
1318 } elsif ( $meta{type} eq 'searchid' ) {
1319 print "Search '$meta{topic}' returned id $meta{id}" if &debug;
1322 exists $id_map{__searches}{ $meta{account} }{ $meta{topic} }
1324 $id_map{__searches}{ $meta{account} }{ $meta{topic} } )
1326 $id_map{__searches}{ $meta{account} }{ $meta{topic} } =
1329 print "Search '$meta{topic}' returned invalid id $meta{id}";
1331 } elsif ( $meta{type} eq 'last_id' ) {
1332 $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} =
1334 if $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} <
1336 } elsif ( $meta{type} eq 'last_id_fixreplies' ) {
1337 $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} =
1339 if $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} <
1341 } elsif ( $meta{type} eq 'error' ) {
1342 push @lines, [ MSGLEVEL_MSGS, $_ ];
1343 } elsif ( $meta{type} eq 'debug' ) {
1344 print "$_" if &debug,;
1346 print "Unknown line type $meta{type}: $_" if &debug,;
1352 if (/^__updated (\d+)$/) {
1353 $last_friends_poll = $1;
1354 print "Friend list updated" if &debug;
1359 $new_last_poll = $1;
1360 if ( $new_last_poll >= $last_poll ) {
1363 print "Impossible! ",
1364 "new_last_poll=$new_last_poll < last_poll=$last_poll!"
1366 undef $new_last_poll;
1370 my ( $f, $t ) = split ' ', $_;
1371 $nicks{$f} = $friends{$f} = $t;
1374 if ($new_last_poll) {
1375 print "new last_poll = $new_last_poll" if &debug;
1376 print "new last_poll_id = ", Dumper( $id_map{__last_id} ) if &debug;
1378 print "First call, not printing updates" if &debug;
1380 foreach my $line (@lines) {
1381 $window->printformat(
1383 "twirssi_" . $line->[1],
1384 @$line[ 2 .. $#$line - 1 ],
1385 &hilight( $line->[-1] )
1392 or warn "Failed to remove $filename: $!"
1395 # commit the pending cache lines to the actual cache, now that
1396 # we've printed our output
1397 %tweet_cache = ( %tweet_cache, %new_cache );
1399 # keep enough cached tweets, to make sure we don't show duplicates.
1400 foreach ( keys %tweet_cache ) {
1401 next if $tweet_cache{$_} >= $last_poll - 3600;
1402 delete $tweet_cache{$_};
1404 $last_poll = $new_last_poll;
1406 # make sure the pid is removed from the waitpid list
1407 Irssi::pidwait_remove($child_pid);
1409 # and that we don't leave any zombies behind, somehow
1415 Irssi::settings_get_str("twirssi_replies_store") )
1417 if ( open JSON, ">$file" ) {
1418 print JSON JSON::Any->objToJson( \%id_map );
1421 &ccrap("Failed to write replies to $file: $!");
1432 if ( $attempt < 24 ) {
1433 Irssi::timeout_add_once( 5000, 'monitor_child',
1434 [ $filename, $attempt + 1 ] );
1436 print "Giving up on polling $filename" if &debug;
1437 Irssi::pidwait_remove($child_pid);
1439 unlink $filename unless &debug;
1441 return unless Irssi::settings_get_bool("twirssi_notify_timeouts");
1444 my @time = localtime($last_poll);
1445 if ( time - $last_poll < 24 * 60 * 60 ) {
1446 $since = sprintf( "%d:%02d", @time[ 2, 1 ] );
1448 $since = scalar localtime($last_poll);
1451 if ( not $failwhale and time - $last_poll > 60 * 60 ) {
1456 q{ .--./ / | _.---.| },
1468 if ( time - $last_poll < 600 ) {
1469 &ccrap("Haven't been able to get updated tweets since $since");
1475 return Irssi::settings_get_bool("twirssi_debug");
1479 $window->print( "%R***%n @_", MSGLEVEL_PUBLIC );
1483 $window->print( "%R***%n @_", MSGLEVEL_CLIENTCRAP );
1489 if ( Irssi::settings_get_bool("tweet_to_away")
1491 and $data !~ /^[dD] / )
1494 Irssi::server_find_tag( Irssi::settings_get_str("bitlbee_server") );
1496 $server->send_raw("away :$data");
1499 &ccrap( "Can't find bitlbee server.",
1500 "Update bitlbee_server or disable tweet_to_away" );
1510 my $noalert = shift;
1512 if ( length $data > 140 ) {
1513 ¬ice( "Tweet too long (" . length($data) . " characters) - aborted" )
1521 sub valid_username {
1522 my $username = shift;
1524 $username = &normalize_username($username);
1526 unless ( exists $twits{$username} ) {
1527 ¬ice("Unknown username $username");
1537 ¬ice("Not logged in! Use /twitter_login username pass!");
1545 my ( $complist, $window, $word, $linestart, $want_space ) = @_;
1548 $linestart =~ /^\/(?:retweet|twitter_reply)(?:_as)?\s*$/
1549 or ( Irssi::settings_get_bool("twirssi_use_reply_aliases")
1550 and $linestart =~ /^\/reply(?:_as)?\s*$/ )
1552 { # /twitter_reply gets a nick:num
1554 @$complist = map { "$_:$id_map{__indexes}{$_}" }
1555 sort { $nicks{$b} <=> $nicks{$a} }
1557 keys %{ $id_map{__indexes} };
1561 /^\/(twitter_unfriend|twitter_add_follow_extra|twitter_del_follow_extra)\s*$/
1563 { # /twitter_unfriend gets a nick
1565 push @$complist, grep /^\Q$word/i,
1566 sort { $nicks{$b} <=> $nicks{$a} } keys %nicks;
1569 # /tweet, /tweet_as, /dm, /dm_as - complete @nicks (and nicks as the first
1571 if ( $linestart =~ /^\/(?:tweet|dm)/ ) {
1572 my $prefix = $word =~ s/^@//;
1573 $prefix = 0 if $linestart eq '/dm' or $linestart eq '/dm_as';
1574 push @$complist, grep /^\Q$word/i,
1575 sort { $nicks{$b} <=> $nicks{$a} } keys %nicks;
1576 @$complist = map { "\@$_" } @$complist if $prefix;
1580 sub event_send_text {
1581 my ( $line, $server, $win ) = @_;
1582 my $awin = Irssi::active_win();
1584 # if the window where we got our text was the twitter window, and the user
1585 # wants to be lazy, tweet away!
1586 if ( ( $awin->get_active_name() eq $window->{name} )
1587 and Irssi::settings_get_bool("tweet_window_input") )
1589 &cmd_tweet( $line, $server, $win );
1594 my $poll = Irssi::settings_get_int("twitter_poll_interval");
1595 return $poll if $poll >= 60;
1602 if ( Irssi::settings_get_str("twirssi_nick_color") ) {
1603 my $c = Irssi::settings_get_str("twirssi_nick_color");
1604 $c = $irssi_to_mirc_colors{$c};
1605 $text =~ s/(^|\W)\@([-\w]+)/$1\cC$c\@$2\cO/g if $c;
1607 if ( Irssi::settings_get_str("twirssi_topic_color") ) {
1608 my $c = Irssi::settings_get_str("twirssi_topic_color");
1609 $c = $irssi_to_mirc_colors{$c};
1610 $text =~ s/(^|\W)(\#|\!)([-\w]+)/$1\cC$c$2$3\cO/g if $c;
1612 $text =~ s/[\n\r]/ /g;
1620 my $provider = Irssi::settings_get_str("short_url_provider");
1623 Irssi::settings_get_bool("twirssi_always_shorten")
1624 or &too_long( $data, 1 )
1630 if ( $provider eq 'Bitly' ) {
1631 @args[ 1, 2 ] = split ',',
1632 Irssi::settings_get_str("short_url_args"), 2;
1633 unless ( @args == 3 ) {
1635 "WWW::Shorten::Bitly requires a username and API key.",
1636 "Set short_url_args to username,API_key or change your",
1637 "short_url_provider."
1639 return decode "utf8", $data;
1643 foreach my $url ( $data =~ /(https?:\/\/\S+[\w\/])/g ) {
1646 my $short = makeashorterlink(@args);
1648 $data =~ s/\Q$url/$short/g;
1650 ¬ice("Failed to shorten $url!");
1656 return decode "utf8", $data;
1659 sub normalize_username {
1662 my ( $username, $service ) = split /\@/, $user, 2;
1664 $service = ucfirst lc $service;
1667 ucfirst lc Irssi::settings_get_str("twirssi_default_service");
1668 unless ( exists $twits{"$username\@$service"} ) {
1670 foreach my $t ( sort keys %twits ) {
1671 next unless $t =~ /^\Q$username\E\@(Twitter|Identica)/;
1677 ¬ice("Can't find a logged in user '$user'");
1682 return "$username\@$service";
1685 Irssi::signal_add( "send text", "event_send_text" );
1687 Irssi::theme_register(
1689 'twirssi_tweet', '[$0%B@$1%n$2] $3',
1690 'twirssi_search', '[$0%r$1%n:%B@$2%n$3] $4',
1691 'twirssi_reply', '[$0\--> %B@$1%n$2] $3',
1692 'twirssi_dm', '[$0%r@$1%n (%WDM%n)] $2',
1693 'twirssi_error', 'ERROR: $0',
1697 Irssi::settings_add_int( "twirssi", "twitter_poll_interval", 300 );
1698 Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" );
1699 Irssi::settings_add_str( "twirssi", "bitlbee_server", "bitlbee" );
1700 Irssi::settings_add_str( "twirssi", "short_url_provider", "TinyURL" );
1701 Irssi::settings_add_str( "twirssi", "short_url_args", undef );
1702 Irssi::settings_add_str( "twirssi", "twitter_usernames", undef );
1703 Irssi::settings_add_str( "twirssi", "twitter_passwords", undef );
1704 Irssi::settings_add_str( "twirssi", "twirssi_default_service", "Twitter" );
1705 Irssi::settings_add_str( "twirssi", "twirssi_nick_color", "%B" );
1706 Irssi::settings_add_str( "twirssi", "twirssi_topic_color", "%r" );
1707 Irssi::settings_add_str( "twirssi", "twirssi_retweet_format",
1708 'RT $n: "$t" ${-- $c$}' );
1709 Irssi::settings_add_str( "twirssi", "twirssi_location",
1710 ".irssi/scripts/twirssi.pl" );
1711 Irssi::settings_add_str( "twirssi", "twirssi_replies_store",
1712 ".irssi/scripts/twirssi.json" );
1714 Irssi::settings_add_int( "twirssi", "twitter_friends_poll", 600 );
1715 Irssi::settings_add_int( "twirssi", "twitter_timeout", 30 );
1717 Irssi::settings_add_bool( "twirssi", "twirssi_upgrade_beta", 0 );
1718 Irssi::settings_add_bool( "twirssi", "tweet_to_away", 0 );
1719 Irssi::settings_add_bool( "twirssi", "show_reply_context", 0 );
1720 Irssi::settings_add_bool( "twirssi", "show_own_tweets", 1 );
1721 Irssi::settings_add_bool( "twirssi", "twirssi_debug", 0 );
1722 Irssi::settings_add_bool( "twirssi", "twirssi_first_run", 1 );
1723 Irssi::settings_add_bool( "twirssi", "twirssi_track_replies", 1 );
1724 Irssi::settings_add_bool( "twirssi", "twirssi_replies_autonick", 1 );
1725 Irssi::settings_add_bool( "twirssi", "twirssi_use_reply_aliases", 0 );
1726 Irssi::settings_add_bool( "twirssi", "twirssi_notify_timeouts", 1 );
1727 Irssi::settings_add_bool( "twirssi", "twirssi_hilights", 1 );
1728 Irssi::settings_add_bool( "twirssi", "twirssi_always_shorten", 0 );
1729 Irssi::settings_add_bool( "twirssi", "tweet_window_input", 0 );
1730 Irssi::settings_add_bool( "twirssi", "twirssi_avoid_ssl", 0 );
1732 $last_poll = time - &get_poll_time;
1733 $window = Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
1736 ->print( "Couldn't find a window named '"
1737 . Irssi::settings_get_str('twitter_window')
1738 . "', trying to create it." );
1740 Irssi::Windowitem::window_create(
1741 Irssi::settings_get_str('twitter_window'), 1 );
1742 $window->set_name( Irssi::settings_get_str('twitter_window') );
1746 Irssi::command_bind( "dm", "cmd_direct" );
1747 Irssi::command_bind( "dm_as", "cmd_direct_as" );
1748 Irssi::command_bind( "tweet", "cmd_tweet" );
1749 Irssi::command_bind( "tweet_as", "cmd_tweet_as" );
1750 Irssi::command_bind( "retweet", "cmd_retweet" );
1751 Irssi::command_bind( "retweet_as", "cmd_retweet_as" );
1752 Irssi::command_bind( "twitter_reply", "cmd_reply" );
1753 Irssi::command_bind( "twitter_reply_as", "cmd_reply_as" );
1754 Irssi::command_bind( "twitter_login", "cmd_login" );
1755 Irssi::command_bind( "twitter_logout", "cmd_logout" );
1756 Irssi::command_bind( "twitter_switch", "cmd_switch" );
1757 Irssi::command_bind( "twitter_subscribe", "cmd_add_search" );
1758 Irssi::command_bind( "twitter_unsubscribe", "cmd_del_search" );
1759 Irssi::command_bind( "twitter_list_subscriptions", "cmd_list_search" );
1760 Irssi::command_bind( "twirssi_upgrade", "cmd_upgrade" );
1761 Irssi::command_bind( "twitter_updates", "get_updates" );
1762 Irssi::command_bind( "twitter_add_follow_extra", "cmd_add_follow" );
1763 Irssi::command_bind( "twitter_del_follow_extra", "cmd_del_follow" );
1764 Irssi::command_bind( "twitter_list_follow_extra", "cmd_list_follow" );
1765 Irssi::command_bind( "bitlbee_away", "update_away" );
1766 if ( Irssi::settings_get_bool("twirssi_use_reply_aliases") ) {
1767 Irssi::command_bind( "reply", "cmd_reply" );
1768 Irssi::command_bind( "reply_as", "cmd_reply_as" );
1770 Irssi::command_bind(
1773 print "twits: ", join ", ",
1774 map { "u: $_->{username}\@" . ref($_) } values %twits;
1775 print "selected: $user\@$defservice";
1776 print "friends: ", join ", ", sort keys %friends;
1777 print "nicks: ", join ", ", sort keys %nicks;
1778 print "searches: ", Dumper \%{ $id_map{__searches} };
1779 print "last poll: $last_poll";
1780 if ( open DUMP, ">/tmp/twirssi.cache.txt" ) {
1781 print DUMP Dumper \%tweet_cache;
1783 print "cache written out to /tmp/twirssi.cache.txt";
1787 Irssi::command_bind(
1791 "Twirssi v$VERSION; "
1793 $Net::Twitter::VERSION
1794 ? "Net::Twitter v$Net::Twitter::VERSION. "
1798 $Net::Identica::VERSION
1799 ? "Net::Identica v$Net::Identica::VERSION. "
1803 . JSON::Any::handler()
1804 . ". See details at http://twirssi.com/"
1808 Irssi::command_bind(
1811 "/twitter_follow <username>",
1813 sub { ¬ice("Following $_[0]"); $nicks{ $_[0] } = time; }
1816 Irssi::command_bind(
1819 "/twitter_unfriend <username>",
1821 sub { ¬ice("Stopped following $_[0]"); delete $nicks{ $_[0] }; }
1824 Irssi::command_bind(
1825 "twitter_device_updates",
1827 "/twitter_device_updates none|im|sms",
1828 "update_delivery_device",
1829 sub { ¬ice("Device updated to $_[0]"); }
1832 Irssi::command_bind(
1835 "/twitter_block <username>",
1837 sub { ¬ice("Blocked $_[0]"); }
1840 Irssi::command_bind(
1843 "/twitter_unblock <username>",
1845 sub { ¬ice("Unblock $_[0]"); }
1848 Irssi::signal_add_last( 'complete word' => \&sig_complete );
1850 ¬ice(" %Y<%C(%B^%C)%N TWIRSSI v%R$VERSION%N");
1851 ¬ice(" %C(_(\\%N http://twirssi.com/ for full docs");
1853 " %Y||%C `%N Log in with /twitter_login, send updates with /tweet");
1855 my $file = Irssi::settings_get_str("twirssi_replies_store");
1856 if ( $file and -r $file ) {
1857 if ( open( JSON, $file ) ) {
1862 my $ref = JSON::Any->jsonToObj($json);
1864 my $num = keys %{ $id_map{__indexes} };
1865 ¬ice( sprintf "Loaded old replies from %d contact%s.",
1866 $num, ( $num == 1 ? "" : "s" ) );
1871 ¬ice("Failed to load old replies from $file: $!");
1875 if ( my $provider = Irssi::settings_get_str("short_url_provider") ) {
1876 ¬ice("Loading WWW::Shorten::$provider...");
1877 eval "use WWW::Shorten::$provider;";
1881 "Failed to load WWW::Shorten::$provider - either clear",
1882 "short_url_provider or install the CPAN module"
1887 if ( my $autouser = Irssi::settings_get_str("twitter_usernames")
1888 and my $autopass = Irssi::settings_get_str("twitter_passwords") )
1896 ->print( "Create a window named "
1897 . Irssi::settings_get_str('twitter_window')
1898 . " or change the value of twitter_window. Then, reload twirssi." );
1901 # vim: set sts=4 expandtab: