10 $Data::Dumper::Indent = 1;
12 use vars qw($VERSION %IRSSI);
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";
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?"
708 unless ( $data or Irssi::settings_get_bool("twirssi_upgrade_beta") ) {
709 eval { use Digest::MD5; };
712 ¬ice( "Failed to load Digest::MD5." .
713 " Try '/twirssi_upgrade nomd5' to skip MD5 verification"
718 $md5 = get("http://twirssi.com/md5sum");
722 ¬ice("Failed to download md5sum from peeron! Aborting.");
726 unless ( open( CUR, $loc ) ) {
727 ¬ice( "Failed to read $loc." .
728 " Check that /set twirssi_location is set to the correct location."
733 my $cur_md5 = Digest::MD5::md5_hex(<CUR>);
736 if ( $cur_md5 eq $md5 ) {
737 ¬ice("Current twirssi seems to be up to date.");
743 Irssi::settings_get_bool("twirssi_upgrade_beta")
744 ? "http://github.com/zigdon/twirssi/raw/master/twirssi.pl"
745 : "http://twirssi.com/twirssi.pl";
746 ¬ice("Downloading twirssi from $URL");
747 LWP::Simple::getstore( $URL, "$loc.upgrade" );
749 unless ( -s "$loc.upgrade" ) {
750 ¬ice("Failed to save $loc.upgrade."
751 . " Check that /set twirssi_location is set to the correct location."
756 unless ( $data or Irssi::settings_get_bool("twirssi_upgrade_beta") ) {
757 unless ( open( NEW, "$loc.upgrade" ) ) {
758 ¬ice("Failed to read $loc.upgrade."
759 . " Check that /set twirssi_location is set to the correct location."
764 my $new_md5 = Digest::MD5::md5_hex(<NEW>);
767 if ( $new_md5 ne $md5 ) {
768 ¬ice("MD5 verification failed. expected $md5, got $new_md5");
773 rename $loc, "$loc.backup"
774 or ¬ice("Failed to back up $loc: $!. Aborting")
776 rename "$loc.upgrade", $loc
777 or ¬ice("Failed to rename $loc.upgrade: $!. Aborting")
780 my ( $dir, $file ) = ( $loc =~ m{(.*)/([^/]+)$} );
781 if ( -e "$dir/autorun/$file" ) {
782 ¬ice("Updating $dir/autorun/$file");
783 unlink "$dir/autorun/$file"
784 or ¬ice("Failed to remove old $file from autorun: $!");
785 symlink "../$file", "$dir/autorun/$file"
786 or ¬ice("Failed to create symlink in autorun directory: $!");
789 ¬ice("Download complete. Reload twirssi with /script load $file");
798 while ($page < 11 and $cursor ne "0")
800 print $fh "type:debug Loading friends page $page...\n"
801 if ( $fh and &debug );
803 if (ref $twit =~ /^Net::Twitter/) {
804 $friends = $twit->friends( { cursor => $cursor } );
805 last unless $friends;
806 $cursor = $friends->{next_cursor};
807 $friends = $friends->{users};
809 $friends = $twit->friends( { page => $page } );
810 last unless $friends;
812 $new_friends{ $_->{screen_name} } = time foreach @$friends;
818 print $fh "type:debug Error during friends list update. Aborted.\n";
822 my ( $added, $removed ) = ( 0, 0 );
823 print $fh "type:debug Scanning for new friends...\n" if ( $fh and &debug );
824 foreach ( keys %new_friends ) {
825 next if exists $friends{$_};
830 print $fh "type:debug Scanning for removed friends...\n"
831 if ( $fh and &debug );
832 foreach ( keys %friends ) {
833 next if exists $new_friends{$_};
838 return ( $added, $removed );
842 print scalar localtime, " - get_updates starting" if &debug;
845 Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
848 ->print( "Can't find a window named '"
849 . Irssi::settings_get_str('twitter_window')
850 . "'. Create it or change the value of twitter_window" );
853 return unless &logged_in($twit);
855 my ( $fh, $filename ) = File::Temp::tempfile();
856 binmode( $fh, ":utf8" );
859 if ($child_pid) { # parent
860 Irssi::timeout_add_once( 5000, 'monitor_child',
861 [ "$filename.done", 0 ] );
862 Irssi::pidwait_add($child_pid);
863 } elsif ( defined $child_pid ) { # child
872 foreach ( keys %twits ) {
873 $error++ unless &do_updates( $fh, $_, $twits{$_}, \%context_cache );
875 if ( $id_map{__fixreplies}{$_} ) {
876 my @frusers = sort keys %{ $id_map{__fixreplies}{$_} };
879 unless &get_timeline( $fh, $frusers[ $fix_replies_index{$_} ],
880 $_, $twits{$_}, \%context_cache );
882 $fix_replies_index{$_}++;
883 $fix_replies_index{$_} = 0
884 if $fix_replies_index{$_} >= @frusers;
885 print $fh "id:$fix_replies_index{$_} ",
886 "account:$_ type:fix_replies_index\n";
890 print $fh "__friends__\n";
892 time - $last_friends_poll >
893 Irssi::settings_get_int('twitter_friends_poll') )
895 print $fh "__updated ", time, "\n";
896 my ( $added, $removed ) = &load_friends($fh);
897 if ( $added + $removed ) {
898 print $fh "type:debug %R***%n Friends list updated: ",
900 sprintf( "%d added", $added ),
901 sprintf( "%d removed", $removed ) ),
906 foreach ( sort keys %friends ) {
907 print $fh "$_ $friends{$_}\n";
911 print $fh "type:debug Update encountered errors. Aborted\n";
912 print $fh "-- $last_poll";
914 print $fh "-- $new_poll";
917 rename $filename, "$filename.done";
920 &ccrap("Failed to fork for updating: $!");
922 print scalar localtime, " - get_updates ends" if &debug;
926 my ( $fh, $username, $obj, $cache ) = @_;
928 my $rate_limit = $obj->rate_limit_status();
929 if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
930 ¬ice("Rate limit exceeded for $username");
934 print scalar localtime, " - Polling for updates for $username" if &debug;
938 if ( $id_map{__last_id}{$username}{timeline} )
940 $tweets = $obj->friends_timeline( { count => 100 } );
942 $tweets = $obj->friends_timeline();
947 print $fh "type:debug Error during friends_timeline call: Aborted.\n";
948 print $fh "type:debug : $_\n" foreach split /\n/, Dumper($@);
952 unless ( ref $tweets ) {
953 if ( $obj->can("get_error") ) {
954 my $error = "Unknown error";
955 eval { $error = JSON::Any->jsonToObj( $obj->get_error() ) };
956 unless ($@) { $error = $obj->get_error() }
958 "type:debug API Error during friends_timeline call: Aborted\n";
959 print $fh "type:debug : $_\n" foreach split /\n/, Dumper($error);
963 "type:debug API Error during friends_timeline call. Aborted.\n";
968 foreach my $t ( reverse @$tweets ) {
969 my $text = decode_entities( $t->{text} );
970 $text =~ s/[\n\r]/ /g;
972 if ( Irssi::settings_get_bool("show_reply_context")
973 and $t->{in_reply_to_screen_name} ne $username
974 and $t->{in_reply_to_screen_name}
975 and not exists $friends{ $t->{in_reply_to_screen_name} } )
977 $nicks{ $t->{in_reply_to_screen_name} } = time;
979 unless ( $cache->{ $t->{in_reply_to_status_id} } ) {
981 $cache->{ $t->{in_reply_to_status_id} } =
982 $obj->show_status( $t->{in_reply_to_status_id} );
986 $context = $cache->{ $t->{in_reply_to_status_id} };
989 my $ctext = decode_entities( $context->{text} );
990 $ctext =~ s/[\n\r]/ /g;
991 if ( $context->{truncated} and ref($obj) ne 'Net::Identica' ) {
993 " -- http://twitter.com/$context->{user}{screen_name}"
994 . "/status/$context->{id}";
996 printf $fh "id:%s account:%s nick:%s type:tweet %s\n",
997 $context->{id}, $username,
998 $context->{user}{screen_name}, $ctext;
1003 if $t->{user}{screen_name} eq $username
1004 and not Irssi::settings_get_bool("show_own_tweets");
1005 if ( $t->{truncated} and ref($obj) ne 'Net::Identica' ) {
1006 $text .= " -- http://twitter.com/$t->{user}{screen_name}"
1007 . "/status/$t->{id}";
1009 printf $fh "id:%s account:%s nick:%s type:%s %s\n",
1010 $t->{id}, $username, $t->{user}{screen_name}, $reply, $text;
1011 $new_poll_id = $t->{id} if $new_poll_id < $t->{id};
1013 printf $fh "id:%s account:%s type:last_id timeline\n",
1014 $new_poll_id, $username;
1016 print scalar localtime, " - Polling for replies since ",
1017 $id_map{__last_id}{$username}{reply}
1021 if ( $id_map{__last_id}{$username}{reply} )
1023 $tweets = $obj->replies(
1024 { since_id => $id_map{__last_id}{$username}{reply} } )
1027 $tweets = $obj->replies() || [];
1032 print $fh "type:debug Error during replies call. Aborted.\n";
1036 foreach my $t ( reverse @$tweets ) {
1038 if exists $friends{ $t->{user}{screen_name} };
1040 my $text = decode_entities( $t->{text} );
1041 $text =~ s/[\n\r]/ /g;
1042 if ( $t->{truncated} ) {
1043 $text .= " -- http://twitter.com/$t->{user}{screen_name}"
1044 . "/status/$t->{id}";
1046 printf $fh "id:%s account:%s nick:%s type:tweet %s\n",
1047 $t->{id}, $username, $t->{user}{screen_name}, $text;
1048 $new_poll_id = $t->{id} if $new_poll_id < $t->{id};
1050 printf $fh "id:%s account:%s type:last_id reply\n", $new_poll_id, $username;
1052 print scalar localtime, " - Polling for DMs" if &debug;
1055 if ( $id_map{__last_id}{$username}{dm} )
1057 $tweets = $obj->direct_messages(
1058 { since_id => $id_map{__last_id}{$username}{dm} } )
1061 $tweets = $obj->direct_messages() || [];
1066 print $fh "type:debug Error during direct_messages call. Aborted.\n";
1070 foreach my $t ( reverse @$tweets ) {
1071 my $text = decode_entities( $t->{text} );
1072 $text =~ s/[\n\r]/ /g;
1073 printf $fh "id:%s account:%s nick:%s type:dm %s\n",
1074 $t->{id}, $username, $t->{sender_screen_name}, $text;
1075 $new_poll_id = $t->{id} if $new_poll_id < $t->{id};
1077 printf $fh "id:%s account:%s type:last_id dm\n", $new_poll_id, $username;
1079 print scalar localtime, " - Polling for subscriptions" if &debug;
1080 if ( $obj->can('search') and $id_map{__searches}{$username} ) {
1082 foreach my $topic ( sort keys %{ $id_map{__searches}{$username} } ) {
1083 print $fh "type:debug searching for $topic since ",
1084 "$id_map{__searches}{$username}{$topic}\n";
1086 $search = $obj->search(
1089 since_id => $id_map{__searches}{$username}{$topic}
1096 "type:debug Error during search($topic) call. Aborted.\n";
1100 unless ( $search->{max_id} ) {
1101 print $fh "type:debug Invalid search results when searching",
1102 " for $topic. Aborted.\n";
1106 $id_map{__searches}{$username}{$topic} = $search->{max_id};
1107 printf $fh "id:%s account:%s type:searchid topic:%s\n",
1108 $search->{max_id}, $username, $topic;
1110 foreach my $t ( reverse @{ $search->{results} } ) {
1111 my $text = decode_entities( $t->{text} );
1112 $text =~ s/[\n\r]/ /g;
1113 printf $fh "id:%s account:%s nick:%s type:search topic:%s %s\n",
1114 $t->{id}, $username, $t->{from_user}, $topic, $text;
1115 $new_poll_id = $t->{id}
1117 or $t->{id} < $new_poll_id;
1122 print scalar localtime, " - Done" if &debug;
1128 my ( $fh, $target, $username, $obj, $cache ) = @_;
1130 my $last_id = $id_map{__last_id}{$username}{$target};
1132 print $fh "type:debug get_timeline(" .
1133 "$fix_replies_index{$username}=$target > $last_id) started." .
1134 " username = $username\n";
1136 $tweets = $obj->user_timeline(
1140 $last_id ? (since_id => $last_id) : ()
1148 "type:debug Error during user_timeline($target) call: Aborted.\n";
1149 print $fh "type:debug : $_\n" foreach split /\n/, Dumper($@);
1155 "type:debug user_timeline($target) call returned undef! Aborted\n";
1159 foreach my $t ( reverse @$tweets ) {
1160 my $text = decode_entities( $t->{text} );
1161 $text =~ s/[\n\r]/ /g;
1162 my $reply = "tweet";
1163 if ( Irssi::settings_get_bool("show_reply_context")
1164 and $t->{in_reply_to_screen_name} ne $username
1165 and $t->{in_reply_to_screen_name}
1166 and not exists $friends{ $t->{in_reply_to_screen_name} } )
1168 $nicks{ $t->{in_reply_to_screen_name} } = time;
1170 unless ( $cache->{ $t->{in_reply_to_status_id} } ) {
1172 $cache->{ $t->{in_reply_to_status_id} } =
1173 $obj->show_status( $t->{in_reply_to_status_id} );
1177 $context = $cache->{ $t->{in_reply_to_status_id} };
1180 my $ctext = decode_entities( $context->{text} );
1181 $ctext =~ s/[\n\r]/ /g;
1182 if ( $context->{truncated} and ref($obj) ne 'Net::Identica' ) {
1184 " -- http://twitter.com/$context->{user}{screen_name}"
1185 . "/status/$context->{id}";
1187 printf $fh "id:%s account:%s nick:%s type:tweet %s\n",
1188 $context->{id}, $username,
1189 $context->{user}{screen_name}, $ctext;
1193 if ( $t->{truncated} and ref($obj) ne 'Net::Identica' ) {
1194 $text .= " -- http://twitter.com/$t->{user}{screen_name}"
1195 . "/status/$t->{id}";
1197 printf $fh "id:%s account:%s nick:%s type:%s %s\n",
1198 $t->{id}, $username, $t->{user}{screen_name}, $reply, $text;
1199 $last_id = $t->{id} if $last_id < $t->{id};
1201 printf $fh "id:%s account:%s type:last_id_fixreplies %s\n",
1202 $last_id, $username, $target;
1209 my $filename = $data->[0];
1210 my $attempt = $data->[1];
1212 print scalar localtime, " - checking child log at $filename ($attempt)"
1214 my ($new_last_poll);
1216 # first time we run we don't want to print out *everything*, so we just
1219 if ( open FILE, $filename ) {
1220 binmode FILE, ":utf8";
1224 last if /^__friends__/;
1225 unless (/\n$/) { # skip partial lines
1226 # print "Skipping partial line: $_" if &debug;
1233 foreach my $key (qw/id account nick type topic/) {
1234 if (s/^$key:(\S+)\s*//) {
1239 if ( $meta{type} and $meta{type} eq 'fix_replies_index' ) {
1240 $fix_replies_index{ $meta{account} } = $meta{id};
1241 print "fix_replies_index for $meta{account} set to $meta{id}"
1246 if ( not $meta{type} or $meta{type} !~ /searchid|last_id/ ) {
1247 if ( exists $meta{id} and exists $new_cache{ $meta{id} } ) {
1251 $new_cache{ $meta{id} } = time;
1253 if ( exists $meta{id} and exists $tweet_cache{ $meta{id} } ) {
1259 $meta{account} =~ s/\@(\w+)$//;
1260 $meta{service} = $1;
1262 lc $meta{service} eq
1263 lc Irssi::settings_get_str("twirssi_default_service") )
1265 $account = "$meta{account}: "
1266 if lc "$meta{account}\@$meta{service}" ne lc
1267 "$user\@$defservice";
1269 $account = "$meta{account}\@$meta{service}: ";
1273 if ( $meta{type} ne 'dm'
1274 and Irssi::settings_get_bool("twirssi_track_replies")
1278 $marker = ( $id_map{__indexes}{ $meta{nick} } + 1 ) % 100;
1279 $id_map{ lc $meta{nick} }[$marker] = $meta{id};
1280 $id_map{__indexes}{ $meta{nick} } = $marker;
1281 $id_map{__tweets}{ lc $meta{nick} }[$marker] = $_;
1282 $marker = ":$marker";
1286 $irssi_to_mirc_colors{ Irssi::settings_get_str("hilight_color") };
1287 my $nick = "\@$meta{account}";
1288 if ( $_ =~ /\Q$nick\E(?:\W|$)/i
1289 and Irssi::settings_get_bool("twirssi_hilights") )
1291 $meta{nick} = "\cC$hilight_color$meta{nick}\cO";
1292 $hilight = MSGLEVEL_HILIGHT;
1295 if ( $meta{type} =~ /tweet|reply/ ) {
1298 ( MSGLEVEL_PUBLIC | $hilight ),
1299 $meta{type}, $account, $meta{nick}, $marker, $_
1301 } elsif ( $meta{type} eq 'search' ) {
1304 ( MSGLEVEL_PUBLIC | $hilight ),
1305 $meta{type}, $account, $meta{topic},
1306 $meta{nick}, $marker, $_
1309 exists $id_map{__searches}{ $meta{account} }{ $meta{topic} }
1311 $id_map{__searches}{ $meta{account} }{ $meta{topic} } )
1313 $id_map{__searches}{ $meta{account} }{ $meta{topic} } =
1316 } elsif ( $meta{type} eq 'dm' ) {
1319 ( MSGLEVEL_MSGS | $hilight ),
1320 $meta{type}, $account, $meta{nick}, $_
1322 } elsif ( $meta{type} eq 'searchid' ) {
1323 print "Search '$meta{topic}' returned id $meta{id}" if &debug;
1326 exists $id_map{__searches}{ $meta{account} }{ $meta{topic} }
1328 $id_map{__searches}{ $meta{account} }{ $meta{topic} } )
1330 $id_map{__searches}{ $meta{account} }{ $meta{topic} } =
1333 print "Search '$meta{topic}' returned invalid id $meta{id}";
1335 } elsif ( $meta{type} eq 'last_id' ) {
1336 $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} =
1338 if $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} <
1340 } elsif ( $meta{type} eq 'last_id_fixreplies' ) {
1341 $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} =
1343 if $id_map{__last_id}{"$meta{account}\@$meta{service}"}{$_} <
1345 } elsif ( $meta{type} eq 'error' ) {
1346 push @lines, [ MSGLEVEL_MSGS, $_ ];
1347 } elsif ( $meta{type} eq 'debug' ) {
1348 print "$_" if &debug,;
1350 print "Unknown line type $meta{type}: $_" if &debug,;
1356 if (/^__updated (\d+)$/) {
1357 $last_friends_poll = $1;
1358 print "Friend list updated" if &debug;
1363 $new_last_poll = $1;
1364 if ( $new_last_poll >= $last_poll ) {
1367 print "Impossible! ",
1368 "new_last_poll=$new_last_poll < last_poll=$last_poll!"
1370 undef $new_last_poll;
1374 my ( $f, $t ) = split ' ', $_;
1375 $nicks{$f} = $friends{$f} = $t;
1378 if ($new_last_poll) {
1379 print "new last_poll = $new_last_poll" if &debug;
1380 print "new last_poll_id = ", Dumper( $id_map{__last_id} ) if &debug;
1382 print "First call, not printing updates" if &debug;
1384 foreach my $line (@lines) {
1385 $window->printformat(
1387 "twirssi_" . $line->[1],
1388 @$line[ 2 .. $#$line - 1 ],
1389 &hilight( $line->[-1] )
1396 or warn "Failed to remove $filename: $!"
1399 # commit the pending cache lines to the actual cache, now that
1400 # we've printed our output
1401 %tweet_cache = ( %tweet_cache, %new_cache );
1403 # keep enough cached tweets, to make sure we don't show duplicates.
1404 foreach ( keys %tweet_cache ) {
1405 next if $tweet_cache{$_} >= $last_poll - 3600;
1406 delete $tweet_cache{$_};
1408 $last_poll = $new_last_poll;
1410 # make sure the pid is removed from the waitpid list
1411 Irssi::pidwait_remove($child_pid);
1413 # and that we don't leave any zombies behind, somehow
1419 Irssi::settings_get_str("twirssi_replies_store") )
1421 if ( open JSON, ">$file" ) {
1422 print JSON JSON::Any->objToJson( \%id_map );
1425 &ccrap("Failed to write replies to $file: $!");
1436 if ( $attempt < 24 ) {
1437 Irssi::timeout_add_once( 5000, 'monitor_child',
1438 [ $filename, $attempt + 1 ] );
1440 print "Giving up on polling $filename" if &debug;
1441 Irssi::pidwait_remove($child_pid);
1443 unlink $filename unless &debug;
1445 return unless Irssi::settings_get_bool("twirssi_notify_timeouts");
1448 my @time = localtime($last_poll);
1449 if ( time - $last_poll < 24 * 60 * 60 ) {
1450 $since = sprintf( "%d:%02d", @time[ 2, 1 ] );
1452 $since = scalar localtime($last_poll);
1455 if ( not $failwhale and time - $last_poll > 60 * 60 ) {
1460 q{ .--./ / | _.---.| },
1472 if ( time - $last_poll < 600 ) {
1473 &ccrap("Haven't been able to get updated tweets since $since");
1479 return Irssi::settings_get_bool("twirssi_debug");
1483 $window->print( "%R***%n @_", MSGLEVEL_PUBLIC );
1487 $window->print( "%R***%n @_", MSGLEVEL_CLIENTCRAP );
1493 if ( Irssi::settings_get_bool("tweet_to_away")
1495 and $data !~ /^[dD] / )
1498 Irssi::server_find_tag( Irssi::settings_get_str("bitlbee_server") );
1500 $server->send_raw("away :$data");
1503 &ccrap( "Can't find bitlbee server.",
1504 "Update bitlbee_server or disable tweet_to_away" );
1514 my $noalert = shift;
1516 if ( length $data > 140 ) {
1517 ¬ice( "Tweet too long (" . length($data) . " characters) - aborted" )
1525 sub valid_username {
1526 my $username = shift;
1528 $username = &normalize_username($username);
1530 unless ( exists $twits{$username} ) {
1531 ¬ice("Unknown username $username");
1541 ¬ice("Not logged in! Use /twitter_login username pass!");
1549 my ( $complist, $window, $word, $linestart, $want_space ) = @_;
1552 $linestart =~ /^\/(?:retweet|twitter_reply)(?:_as)?\s*$/
1553 or ( Irssi::settings_get_bool("twirssi_use_reply_aliases")
1554 and $linestart =~ /^\/reply(?:_as)?\s*$/ )
1556 { # /twitter_reply gets a nick:num
1558 @$complist = map { "$_:$id_map{__indexes}{$_}" }
1559 sort { $nicks{$b} <=> $nicks{$a} }
1561 keys %{ $id_map{__indexes} };
1564 if ( $linestart =~ /^\/(twitter_unfriend|twitter_add_follow_extra|twitter_del_follow_extra)\s*$/ )
1565 { # /twitter_unfriend gets a nick
1567 push @$complist, grep /^\Q$word/i,
1568 sort { $nicks{$b} <=> $nicks{$a} } keys %nicks;
1571 # /tweet, /tweet_as, /dm, /dm_as - complete @nicks (and nicks as the first
1573 if ( $linestart =~ /^\/(?:tweet|dm)/ ) {
1574 my $prefix = $word =~ s/^@//;
1575 $prefix = 0 if $linestart eq '/dm' or $linestart eq '/dm_as';
1576 push @$complist, grep /^\Q$word/i,
1577 sort { $nicks{$b} <=> $nicks{$a} } keys %nicks;
1578 @$complist = map { "\@$_" } @$complist if $prefix;
1582 sub event_send_text {
1583 my ( $line, $server, $win ) = @_;
1584 my $awin = Irssi::active_win();
1586 # if the window where we got our text was the twitter window, and the user
1587 # wants to be lazy, tweet away!
1588 if ( ( $awin->get_active_name() eq $window->{name} )
1589 and Irssi::settings_get_bool("tweet_window_input") )
1591 &cmd_tweet( $line, $server, $win );
1596 my $poll = Irssi::settings_get_int("twitter_poll_interval");
1597 return $poll if $poll >= 60;
1604 if ( Irssi::settings_get_str("twirssi_nick_color") ) {
1605 my $c = Irssi::settings_get_str("twirssi_nick_color");
1606 $c = $irssi_to_mirc_colors{$c};
1607 $text =~ s/(^|\W)\@([-\w]+)/$1\cC$c\@$2\cO/g if $c;
1609 if ( Irssi::settings_get_str("twirssi_topic_color") ) {
1610 my $c = Irssi::settings_get_str("twirssi_topic_color");
1611 $c = $irssi_to_mirc_colors{$c};
1612 $text =~ s/(^|\W)(\#|\!)([-\w]+)/$1\cC$c$2$3\cO/g if $c;
1614 $text =~ s/[\n\r]/ /g;
1622 my $provider = Irssi::settings_get_str("short_url_provider");
1625 Irssi::settings_get_bool("twirssi_always_shorten")
1626 or &too_long( $data, 1 )
1632 if ( $provider eq 'Bitly' ) {
1633 @args[ 1, 2 ] = split ',',
1634 Irssi::settings_get_str("short_url_args"), 2;
1635 unless ( @args == 3 ) {
1637 "WWW::Shorten::Bitly requires a username and API key.",
1638 "Set short_url_args to username,API_key or change your",
1639 "short_url_provider."
1641 return decode "utf8", $data;
1645 foreach my $url ( $data =~ /(https?:\/\/\S+[\w\/])/g ) {
1648 my $short = makeashorterlink(@args);
1650 $data =~ s/\Q$url/$short/g;
1652 ¬ice("Failed to shorten $url!");
1658 return decode "utf8", $data;
1661 sub normalize_username {
1664 my ( $username, $service ) = split /\@/, $user, 2;
1666 $service = ucfirst lc $service;
1669 ucfirst lc Irssi::settings_get_str("twirssi_default_service");
1670 unless ( exists $twits{"$username\@$service"} ) {
1672 foreach my $t ( sort keys %twits ) {
1673 next unless $t =~ /^\Q$username\E\@(Twitter|Identica)/;
1679 ¬ice("Can't find a logged in user '$user'");
1684 return "$username\@$service";
1687 Irssi::signal_add( "send text", "event_send_text" );
1689 Irssi::theme_register(
1691 'twirssi_tweet', '[$0%B@$1%n$2] $3',
1692 'twirssi_search', '[$0%r$1%n:%B@$2%n$3] $4',
1693 'twirssi_reply', '[$0\--> %B@$1%n$2] $3',
1694 'twirssi_dm', '[$0%r@$1%n (%WDM%n)] $2',
1695 'twirssi_error', 'ERROR: $0',
1699 Irssi::settings_add_int( "twirssi", "twitter_poll_interval", 300 );
1700 Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" );
1701 Irssi::settings_add_str( "twirssi", "bitlbee_server", "bitlbee" );
1702 Irssi::settings_add_str( "twirssi", "short_url_provider", "TinyURL" );
1703 Irssi::settings_add_str( "twirssi", "short_url_args", undef );
1704 Irssi::settings_add_str( "twirssi", "twitter_usernames", undef );
1705 Irssi::settings_add_str( "twirssi", "twitter_passwords", undef );
1706 Irssi::settings_add_str( "twirssi", "twirssi_default_service", "Twitter" );
1707 Irssi::settings_add_str( "twirssi", "twirssi_nick_color", "%B" );
1708 Irssi::settings_add_str( "twirssi", "twirssi_topic_color", "%r" );
1709 Irssi::settings_add_str( "twirssi", "twirssi_retweet_format",
1710 'RT $n: "$t" ${-- $c$}' );
1711 Irssi::settings_add_str( "twirssi", "twirssi_location",
1712 ".irssi/scripts/twirssi.pl" );
1713 Irssi::settings_add_str( "twirssi", "twirssi_replies_store",
1714 ".irssi/scripts/twirssi.json" );
1716 Irssi::settings_add_int( "twirssi", "twitter_friends_poll", 600 );
1717 Irssi::settings_add_int( "twirssi", "twitter_timeout", 30 );
1719 Irssi::settings_add_bool( "twirssi", "twirssi_upgrade_beta", 0 );
1720 Irssi::settings_add_bool( "twirssi", "tweet_to_away", 0 );
1721 Irssi::settings_add_bool( "twirssi", "show_reply_context", 0 );
1722 Irssi::settings_add_bool( "twirssi", "show_own_tweets", 1 );
1723 Irssi::settings_add_bool( "twirssi", "twirssi_debug", 0 );
1724 Irssi::settings_add_bool( "twirssi", "twirssi_first_run", 1 );
1725 Irssi::settings_add_bool( "twirssi", "twirssi_track_replies", 1 );
1726 Irssi::settings_add_bool( "twirssi", "twirssi_replies_autonick", 1 );
1727 Irssi::settings_add_bool( "twirssi", "twirssi_use_reply_aliases", 0 );
1728 Irssi::settings_add_bool( "twirssi", "twirssi_notify_timeouts", 1 );
1729 Irssi::settings_add_bool( "twirssi", "twirssi_hilights", 1 );
1730 Irssi::settings_add_bool( "twirssi", "twirssi_always_shorten", 0 );
1731 Irssi::settings_add_bool( "twirssi", "tweet_window_input", 0 );
1732 Irssi::settings_add_bool( "twirssi", "twirssi_avoid_ssl", 0 );
1734 $last_poll = time - &get_poll_time;
1735 $window = Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
1738 ->print( "Couldn't find a window named '"
1739 . Irssi::settings_get_str('twitter_window')
1740 . "', trying to create it." );
1742 Irssi::Windowitem::window_create(
1743 Irssi::settings_get_str('twitter_window'), 1 );
1744 $window->set_name( Irssi::settings_get_str('twitter_window') );
1748 Irssi::command_bind( "dm", "cmd_direct" );
1749 Irssi::command_bind( "dm_as", "cmd_direct_as" );
1750 Irssi::command_bind( "tweet", "cmd_tweet" );
1751 Irssi::command_bind( "tweet_as", "cmd_tweet_as" );
1752 Irssi::command_bind( "retweet", "cmd_retweet" );
1753 Irssi::command_bind( "retweet_as", "cmd_retweet_as" );
1754 Irssi::command_bind( "twitter_reply", "cmd_reply" );
1755 Irssi::command_bind( "twitter_reply_as", "cmd_reply_as" );
1756 Irssi::command_bind( "twitter_login", "cmd_login" );
1757 Irssi::command_bind( "twitter_logout", "cmd_logout" );
1758 Irssi::command_bind( "twitter_switch", "cmd_switch" );
1759 Irssi::command_bind( "twitter_subscribe", "cmd_add_search" );
1760 Irssi::command_bind( "twitter_unsubscribe", "cmd_del_search" );
1761 Irssi::command_bind( "twitter_list_subscriptions", "cmd_list_search" );
1762 Irssi::command_bind( "twirssi_upgrade", "cmd_upgrade" );
1763 Irssi::command_bind( "twitter_updates", "get_updates" );
1764 Irssi::command_bind( "twitter_add_follow_extra", "cmd_add_follow" );
1765 Irssi::command_bind( "twitter_del_follow_extra", "cmd_del_follow" );
1766 Irssi::command_bind( "twitter_list_follow_extra", "cmd_list_follow" );
1767 Irssi::command_bind( "bitlbee_away", "update_away" );
1768 if ( Irssi::settings_get_bool("twirssi_use_reply_aliases") ) {
1769 Irssi::command_bind( "reply", "cmd_reply" );
1770 Irssi::command_bind( "reply_as", "cmd_reply_as" );
1772 Irssi::command_bind(
1775 print "twits: ", join ", ",
1776 map { "u: $_->{username}\@" . ref($_) } values %twits;
1777 print "selected: $user\@$defservice";
1778 print "friends: ", join ", ", sort keys %friends;
1779 print "nicks: ", join ", ", sort keys %nicks;
1780 print "searches: ", Dumper \%{ $id_map{__searches} };
1781 print "last poll: $last_poll";
1782 if ( open DUMP, ">/tmp/twirssi.cache.txt" ) {
1783 print DUMP Dumper \%tweet_cache;
1785 print "cache written out to /tmp/twirssi.cache.txt";
1789 Irssi::command_bind(
1793 "Twirssi v$VERSION; "
1795 $Net::Twitter::VERSION
1796 ? "Net::Twitter v$Net::Twitter::VERSION. "
1800 $Net::Identica::VERSION
1801 ? "Net::Identica v$Net::Identica::VERSION. "
1805 . JSON::Any::handler()
1806 . ". See details at http://twirssi.com/"
1810 Irssi::command_bind(
1813 "/twitter_follow <username>",
1815 sub { ¬ice("Following $_[0]"); $nicks{ $_[0] } = time; }
1818 Irssi::command_bind(
1821 "/twitter_unfriend <username>",
1823 sub { ¬ice("Stopped following $_[0]"); delete $nicks{ $_[0] }; }
1826 Irssi::command_bind(
1827 "twitter_device_updates",
1829 "/twitter_device_updates none|im|sms",
1830 "update_delivery_device",
1831 sub { ¬ice("Device updated to $_[0]"); }
1834 Irssi::command_bind(
1837 "/twitter_block <username>",
1839 sub { ¬ice("Blocked $_[0]"); }
1842 Irssi::command_bind(
1845 "/twitter_unblock <username>",
1847 sub { ¬ice("Unblock $_[0]"); }
1850 Irssi::signal_add_last( 'complete word' => \&sig_complete );
1852 ¬ice(" %Y<%C(%B^%C)%N TWIRSSI v%R$VERSION%N");
1853 ¬ice(" %C(_(\\%N http://twirssi.com/ for full docs");
1855 " %Y||%C `%N Log in with /twitter_login, send updates with /tweet");
1857 my $file = Irssi::settings_get_str("twirssi_replies_store");
1858 if ( $file and -r $file ) {
1859 if ( open( JSON, $file ) ) {
1864 my $ref = JSON::Any->jsonToObj($json);
1866 my $num = keys %{ $id_map{__indexes} };
1867 ¬ice( sprintf "Loaded old replies from %d contact%s.",
1868 $num, ( $num == 1 ? "" : "s" ) );
1873 ¬ice("Failed to load old replies from $file: $!");
1877 if ( my $provider = Irssi::settings_get_str("short_url_provider") ) {
1878 ¬ice("Loading WWW::Shorten::$provider...");
1879 eval "use WWW::Shorten::$provider;";
1883 "Failed to load WWW::Shorten::$provider - either clear",
1884 "short_url_provider or install the CPAN module"
1889 if ( my $autouser = Irssi::settings_get_str("twitter_usernames")
1890 and my $autopass = Irssi::settings_get_str("twitter_passwords") )
1898 ->print( "Create a window named "
1899 . Irssi::settings_get_str('twitter_window')
1900 . " or change the value of twitter_window. Then, reload twirssi." );
1903 # vim: set sts=4 expandtab: