10 $Data::Dumper::Indent = 1;
12 use vars qw($VERSION %IRSSI);
15 my ($REV) = '$Rev: 379 $' =~ /(\d+)/;
17 authors => 'Dan Boger',
18 contact => 'zigdon@gmail.com',
20 description => 'Send twitter updates using /tweet. '
21 . 'Can optionally set your bitlbee /away message to same',
22 license => 'GNU GPL v2',
23 url => 'http://tinyurl.com/twirssi',
24 changed => '$Date: 2009-01-21 09:50:42 -0800 (Wed, 21 Jan 2009) $',
34 my $last_poll = time - 300;
39 my ( $data, $server, $win ) = @_;
41 return unless &logged_in($twit);
43 my ( $target, $text ) = split ' ', $data, 2;
44 unless ( $target and $text ) {
45 ¬ice("Usage: /dm <nick> <message>");
49 &cmd_direct_as( "$user $data", $server, $win );
53 my ( $data, $server, $win ) = @_;
55 return unless &logged_in($twit);
57 my ( $username, $target, $text ) = split ' ', $data, 3;
58 unless ( $username and $target and $text ) {
59 ¬ice("Usage: /dm_as <username> <nick> <message>");
63 return unless &valid_username($username);
66 unless ( $twits{$username}
67 ->new_direct_message( { user => $target, text => $text } ) )
69 ¬ice("DM to $target failed");
75 ¬ice("DM caused an error. Aborted");
79 ¬ice("DM sent to $target");
80 $nicks{$target} = time;
84 my ( $data, $server, $win ) = @_;
86 return unless &logged_in($twit);
88 $data =~ s/^\s+|\s+$//;
90 ¬ice("Usage: /tweet <update>");
94 &cmd_tweet_as( "$user $data", $server, $win );
98 my ( $data, $server, $win ) = @_;
100 return unless &logged_in($twit);
102 $data =~ s/^\s+|\s+$//;
103 my ( $username, $data ) = split ' ', $data, 2;
105 unless ( $username and $data ) {
106 ¬ice("Usage: /tweet_as <username> <update>");
110 return unless &valid_username($username);
112 if ( Irssi::settings_get_str("short_url_provider") ) {
113 foreach my $url ( $data =~ /(https?:\/\/\S+[\w\/])/g ) {
115 my $short = makeashorterlink($url);
116 $data =~ s/\Q$url/$short/g;
121 return if &too_long($data);
124 unless ( $twits{$username}->update($data) )
126 ¬ice("Update failed");
132 ¬ice("Update caused an error. Aborted.");
136 foreach ( $data =~ /@([-\w]+)/ ) {
140 my $away = &update_away($data);
142 ¬ice( "Update sent" . ( $away ? " (and away msg set)" : "" ) );
146 my ( $data, $server, $win ) = @_;
148 return unless &logged_in($twit);
150 $data =~ s/^\s+|\s+$//;
152 ¬ice("Usage: /reply <nick[:num]> <update>");
156 $data =~ s/^\s+|\s+$//;
157 my ( $id, $data ) = split ' ', $data, 2;
158 unless ( $id and $data ) {
159 ¬ice("Usage: /reply_as <nick[:num]> <update>");
163 &cmd_reply_as( "$user $id $data", $server, $win );
167 my ( $data, $server, $win ) = @_;
169 unless ( Irssi::settings_get_bool("twirssi_track_replies") ) {
170 ¬ice("twirssi_track_replies is required in order to reply to "
171 . "specific tweets. Either enable it, or just use /tweet "
172 . "\@username <text>." );
176 return unless &logged_in($twit);
178 $data =~ s/^\s+|\s+$//;
179 my ( $username, $id, $data ) = split ' ', $data, 3;
181 unless ( $username and $data ) {
182 ¬ice("Usage: /reply_as <username> <nick[:num]> <update>");
186 return unless &valid_username($username);
189 $id =~ s/[^\w\d\-:]+//g;
190 ( $nick, $id ) = split /:/, $id;
191 unless ( exists $id_map{ lc $nick } ) {
192 ¬ice("Can't find a tweet from $nick to reply to!");
196 $id = $id_map{__indexes}{$nick} unless $id;
197 unless ( $id_map{ lc $nick }[$id] ) {
198 ¬ice("Can't find a tweet numbered $id from $nick to reply to!");
202 # remove any @nick at the beginning of the reply, as we'll add it anyway
203 $data =~ s/^\s*\@?$nick\s*//;
204 $data = "\@$nick " . $data;
206 if ( Irssi::settings_get_str("short_url_provider") ) {
207 foreach my $url ( $data =~ /(https?:\/\/\S+[\w\/])/g ) {
209 my $short = makeashorterlink($url);
210 $data =~ s/\Q$url/$short/g;
215 return if &too_long($data);
219 $twits{$username}->update(
222 in_reply_to_status_id => $id_map{ lc $nick }[$id]
227 ¬ice("Update failed");
233 ¬ice("Update caused an error. Aborted");
237 foreach ( $data =~ /@([-\w]+)/ ) {
241 my $away = &update_away($data);
243 ¬ice( "Update sent" . ( $away ? " (and away msg set)" : "" ) );
247 my ( $usage_str, $api_name, $post_ref ) = @_;
250 my ( $data, $server, $win ) = @_;
252 return unless &logged_in($twit);
254 $data =~ s/^\s+|\s+$//;
256 ¬ice("Usage: $usage_str");
261 unless ( $twit->$api_name($data) )
263 ¬ice("$api_name failed");
269 ¬ice("$api_name caused an error. Aborted.");
273 &$post_ref($data) if $post_ref;
278 my ( $data, $server, $win ) = @_;
280 $data =~ s/^\s+|\s+$//g;
281 if ( exists $twits{$data} ) {
282 ¬ice("Switching to $data");
283 $twit = $twits{$data};
286 ¬ice("Unknown user $data");
291 my ( $data, $server, $win ) = @_;
293 $data =~ s/^\s+|\s+$//g;
294 return unless &valid_username($data);
297 ¬ice("Logging out $data...");
298 $twits{$data}->end_session();
299 delete $twits{$data};
301 ¬ice("Logging out $user...");
302 $twit->end_session();
304 delete $twits{$user};
306 &cmd_switch( ( keys %twits )[0], $server, $win );
308 Irssi::timeout_remove($poll) if $poll;
315 my ( $data, $server, $win ) = @_;
318 ( $user, $pass ) = split ' ', $data, 2;
319 } elsif ( my $autouser = Irssi::settings_get_str("twitter_usernames")
320 and my $autopass = Irssi::settings_get_str("twitter_passwords") )
322 my @user = split /\s*,\s*/, $autouser;
323 my @pass = split /\s*,\s*/, $autopass;
324 if ( @user != @pass ) {
325 ¬ice("Number of usernames doesn't match "
326 . "the number of passwords - auto-login failed" );
329 while ( @user and @pass ) {
337 ¬ice("/twitter_login requires either a username and password "
338 . "or twitter_usernames and twitter_passwords to be set." );
342 %friends = %nicks = ();
344 $twit = Net::Twitter->new(
350 unless ( $twit->verify_credentials() ) {
351 ¬ice("Login as $user failed");
354 &cmd_switch( ( keys %twits )[0], $server, $win );
360 my $rate_limit = $twit->rate_limit_status();
361 if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
362 ¬ice("Rate limit exceeded, try again later");
367 $twits{$user} = $twit;
368 Irssi::timeout_remove($poll) if $poll;
369 $poll = Irssi::timeout_add( 300 * 1000, \&get_updates, "" );
370 ¬ice("Logged in as $user, loading friends list...");
372 ¬ice( "loaded friends: ", scalar keys %friends );
373 if ( Irssi::settings_get_bool("twirssi_first_run") ) {
374 Irssi::settings_set_bool( "twirssi_first_run", 0 );
375 unless ( exists $friends{twirssi} ) {
376 ¬ice("Welcome to twirssi!"
377 . " Perhaps you should add \@twirssi to your friends list,"
378 . " so you can be notified when a new version is release?"
379 . " Just type /twitter_friend twirssi." );
386 ¬ice("Login failed");
391 my ( $data, $server, $win ) = @_;
393 my $loc = Irssi::settings_get_str("twirssi_location");
396 "$loc isn't writable, can't upgrade. Perhaps you need to /set twirssi_location?"
401 if ( not -x "/usr/bin/md5sum" and not $data ) {
403 "/usr/bin/md5sum can't be found - try '/twirssi_upgrade nomd5' to skip MD5 verification"
410 eval { use Digest::MD5; };
414 "Failed to load Digest::MD5. Try '/twirssi_upgrade nomd5' to skip MD5 verification"
419 $md5 = get("http://twirssi.com/md5sum");
423 ¬ice("Failed to download md5sum from peeron! Aborting.");
427 unless ( open( CUR, $loc ) ) {
429 "Failed to read $loc. Check that /set twirssi_location is set to the correct location."
434 my $cur_md5 = Digest::MD5::md5_hex(<CUR>);
437 if ( $cur_md5 eq $md5 ) {
438 ¬ice("Current twirssi seems to be up to date.");
443 my $URL = "http://twirssi.com/twirssi.pl";
444 ¬ice("Downloading twirssi from $URL");
445 LWP::Simple::getstore( $URL, "$loc.upgrade" );
448 unless ( open( NEW, "$loc.upgrade" ) ) {
450 "Failed to read $loc.upgrade. Check that /set twirssi_location is set to the correct location."
455 my $new_md5 = Digest::MD5::md5_hex(<NEW>);
458 if ( $new_md5 ne $md5 ) {
459 ¬ice("MD5 verification failed. expected $md5, got $new_md5");
464 rename $loc, "$loc.backup"
465 or ¬ice("Failed to back up $loc: $!. Aborting")
467 rename "$loc.upgrade", $loc
468 or ¬ice("Failed to rename $loc.upgrade: $!. Aborting")
471 my ( $dir, $file ) = ( $loc =~ m{(.*)/([^/]+)$} );
472 if ( -e "$dir/autorun/$file" ) {
473 ¬ice("Updating $dir/autorun/$file");
474 unlink "$dir/autorun/$file"
475 or ¬ice("Failed to remove old $file from autorun: $!");
476 symlink "../$file", "$dir/autorun/$file"
477 or ¬ice("Failed to create symlink in autorun directory: $!");
480 ¬ice("Download complete. Reload twirssi with /script load $file");
490 print $fh "type:debug Loading friends page $page...\n"
491 if ( $fh and &debug );
492 my $friends = $twit->friends( { page => $page } );
493 last unless $friends;
494 $new_friends{ $_->{screen_name} } = time foreach @$friends;
496 last if @$friends == 0 or $page == 10;
501 print $fh "type:debug Error during friends list update. Aborted.\n";
505 my ( $added, $removed ) = ( 0, 0 );
506 print $fh "type:debug Scanning for new friends...\n" if ( $fh and &debug );
507 foreach ( keys %new_friends ) {
508 next if exists $friends{$_};
513 print $fh "type:debug Scanning for removed friends...\n"
514 if ( $fh and &debug );
515 foreach ( keys %friends ) {
516 next if exists $new_friends{$_};
521 return ( $added, $removed );
525 print scalar localtime, " - get_updates starting" if &debug;
528 Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
531 ->print( "Can't find a window named '"
532 . Irssi::settings_get_str('twitter_window')
533 . "'. Create it or change the value of twitter_window" );
536 return unless &logged_in($twit);
538 my ( $fh, $filename ) = File::Temp::tempfile();
542 Irssi::timeout_add_once( 5000, 'monitor_child', [ $filename, 0 ] );
543 Irssi::pidwait_add($pid);
544 } elsif ( defined $pid ) { # child
552 $error += &do_updates( $fh, $user, $twit );
553 foreach ( keys %twits ) {
555 $error += &do_updates( $fh, $_, $twits{$_} );
558 my ( $added, $removed ) = &load_friends($fh);
559 if ( $added + $removed ) {
560 print $fh "type:debug %R***%n Friends list updated: ",
562 sprintf( "%d added", $added ),
563 sprintf( "%d removed", $removed ) ),
566 print $fh "__friends__\n";
567 foreach ( sort keys %friends ) {
568 print $fh "$_ $friends{$_}\n";
572 print $fh "type:debug Update encountered errors. Aborted\n";
573 print $fh $last_poll;
580 print scalar localtime, " - get_updates ends" if &debug;
584 my ( $fh, $username, $obj ) = @_;
586 print scalar localtime, " - Polling for updates for $username" if &debug;
589 $tweets = $obj->friends_timeline(
590 { since => HTTP::Date::time2str($last_poll) } );
594 print $fh "type:debug Error during friends_timeline call. Aborted.\n";
598 unless ( ref $tweets ) {
599 if ( $obj->can("get_error") ) {
601 eval { $error = JSON::Any->jsonToObj( $obj->get_error() ) };
602 if ($@) { $error = $obj->get_error() }
603 print $fh "type:debug API Error during friends_timeline call: ",
607 "type:debug API Error during friends_timeline call. Aborted.\n";
612 foreach my $t ( reverse @$tweets ) {
613 my $text = decode_entities( $t->{text} );
615 $text =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g;
616 $text =~ s/[\n\r]/ /g;
618 if ( Irssi::settings_get_bool("show_reply_context")
619 and $t->{in_reply_to_screen_name} ne $username
620 and $t->{in_reply_to_screen_name}
621 and not exists $friends{ $t->{in_reply_to_screen_name} } )
623 $nicks{ $t->{in_reply_to_screen_name} } = time;
626 $context = $obj->show_status( $t->{in_reply_to_status_id} );
630 my $ctext = decode_entities( $context->{text} );
632 $ctext =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g;
633 $ctext =~ s/[\n\r]/ /g;
634 printf $fh "id:%d account:%s nick:%s type:tweet %s\n",
635 $context->{id}, $username,
636 $context->{user}{screen_name}, $ctext;
639 print $fh "type:debug request to get context failed: $@";
642 "type:debug Failed to get context from $t->{in_reply_to_screen_name}"
647 if $t->{user}{screen_name} eq $username
648 and not Irssi::settings_get_bool("show_own_tweets");
649 printf $fh "id:%d account:%s nick:%s type:%s %s\n",
650 $t->{id}, $username, $t->{user}{screen_name}, $reply, $text;
653 print scalar localtime, " - Polling for replies" if &debug;
655 $tweets = $obj->replies( { since => HTTP::Date::time2str($last_poll) } )
660 print $fh "type:debug Error during replies call. Aborted.\n";
664 foreach my $t ( reverse @$tweets ) {
666 if exists $friends{ $t->{user}{screen_name} };
668 my $text = decode_entities( $t->{text} );
670 $text =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g;
671 $text =~ s/[\n\r]/ /g;
672 printf $fh "id:%d account:%s nick:%s type:tweet %s\n",
673 $t->{id}, $username, $t->{user}{screen_name}, $text;
676 print scalar localtime, " - Polling for DMs" if &debug;
679 $obj->direct_messages( { since => HTTP::Date::time2str($last_poll) } )
684 print $fh "type:debug Error during direct_messages call. Aborted.\n";
688 foreach my $t ( reverse @$tweets ) {
689 my $text = decode_entities( $t->{text} );
691 $text =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g;
692 $text =~ s/[\n\r]/ /g;
693 printf $fh "id:%d account:%s nick:%s type:dm %s\n",
694 $t->{id}, $username, $t->{sender_screen_name}, $text;
696 print scalar localtime, " - Done" if &debug;
703 my $filename = $data->[0];
704 my $attempt = $data->[1];
706 print scalar localtime, " - checking child log at $filename ($attempt)"
709 if ( open FILE, $filename ) {
713 last if /^__friends__/;
715 foreach my $key (qw/id account nick type/) {
716 if (s/^$key:(\S+)\s*//) {
721 next if exists $meta{id} and exists $tweet_cache{ $meta{id} };
722 $tweet_cache{ $meta{id} } = time;
724 if ( $meta{account} ne $user ) {
725 $account = "$meta{account}: ";
729 if ( $meta{type} ne 'dm'
730 and Irssi::settings_get_bool("twirssi_track_replies")
734 $marker = ( $id_map{__indexes}{ $meta{nick} } + 1 ) % 100;
735 $id_map{ lc $meta{nick} }[$marker] = $meta{id};
736 $id_map{__indexes}{ $meta{nick} } = $marker;
737 $marker = ":$marker";
740 if ( $meta{type} eq 'tweet' ) {
741 push @lines, "[$account%B\@$meta{nick}%n$marker] $_\n",;
742 } elsif ( $meta{type} eq 'reply' ) {
743 push @lines, "[$account\\--> %B\@$meta{nick}%n$marker] $_\n",;
744 } elsif ( $meta{type} eq 'dm' ) {
745 push @lines, "[$account%B\@$meta{nick}%n (%WDM%n)] $_\n",;
746 } elsif ( $meta{type} eq 'error' ) {
747 push @lines, "ERROR: $_\n";
748 } elsif ( $meta{type} eq 'debug' ) {
749 print "$_" if &debug,;
751 print "Unknown line type $meta{type}: $_" if &debug,;
761 my ( $f, $t ) = split ' ', $_;
762 $nicks{$f} = $friends{$f} = $t;
765 if ($new_last_poll) {
766 print "new last_poll = $new_last_poll" if &debug;
767 foreach my $line (@lines) {
769 $window->print( $line, MSGLEVEL_PUBLIC );
770 foreach ( $line =~ /\@([-\w]+)/ ) {
777 or warn "Failed to remove $filename: $!"
780 # keep enough cached tweets, to make sure we don't show duplicates.
781 foreach ( keys %tweet_cache ) {
782 next if $tweet_cache{$_} >= $last_poll;
783 delete $tweet_cache{$_};
785 $last_poll = $new_last_poll;
790 Irssi::settings_get_str("twirssi_replies_store") )
792 if ( open JSON, ">$file" ) {
793 print JSON JSON::Any->objToJson( \%id_map );
796 ¬ice("Failed to write replies to $file: $!");
805 if ( $attempt < 12 ) {
806 Irssi::timeout_add_once( 5000, 'monitor_child',
807 [ $filename, $attempt + 1 ] );
809 ¬ice("Giving up on polling $filename");
810 unlink $filename unless &debug;
815 return Irssi::settings_get_bool("twirssi_debug");
819 $window->print( "%R***%n @_", MSGLEVEL_PUBLIC );
825 if ( Irssi::settings_get_bool("tweet_to_away")
827 and $data !~ /^[dD] / )
830 Irssi::server_find_tag( Irssi::settings_get_str("bitlbee_server") );
832 $server->send_raw("away :$data");
835 ¬ice( "Can't find bitlbee server.",
836 "Update bitlbee_server or disable tweet_to_away" );
847 if ( length $data > 140 ) {
849 "Tweet too long (" . length($data) . " characters) - aborted" );
857 my $username = shift;
859 unless ( exists $twits{$username} ) {
860 ¬ice("Unknown username $username");
870 ¬ice("Not logged in! Use /twitter_login username pass!");
878 my ( $complist, $window, $word, $linestart, $want_space ) = @_;
881 $linestart =~ /^\/twitter_reply(?:_as)?\s*$/
882 or ( Irssi::settings_get_bool("twirssi_use_reply_aliases")
883 and $linestart =~ /^\/reply(?:_as)?\s*$/ )
885 { # /twitter_reply gets a nick:num
887 @$complist = map { "$_:$id_map{__indexes}{$_}" } grep /^\Q$word/i,
888 sort keys %{ $id_map{__indexes} };
891 # /tweet, /tweet_as, /dm, /dm_as - complete @nicks (and nicks as the first
893 if ( $linestart =~ /^\/(?:tweet|dm)/ ) {
894 my $prefix = $word =~ s/^@//;
895 $prefix = 0 if $linestart eq '/dm' or $linestart eq '/dm_as';
896 push @$complist, grep /^\Q$word/i,
897 sort { $nicks{$b} <=> $nicks{$a} } keys %nicks;
898 @$complist = map { "\@$_" } @$complist if $prefix;
902 sub event_send_text {
903 my ( $line, $server, $win ) = @_;
904 my $awin = Irssi::active_win();
906 # if the window where we got our text was the twitter window, and the user
907 # wants to be lazy, tweet away!
908 if ( ( $awin->get_active_name() eq $window->{name} )
909 and Irssi::settings_get_bool("tweet_window_input") )
911 &cmd_tweet( $line, $server, $win );
915 Irssi::signal_add( "send text", "event_send_text" );
917 Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" );
918 Irssi::settings_add_str( "twirssi", "bitlbee_server", "bitlbee" );
919 Irssi::settings_add_str( "twirssi", "short_url_provider", "TinyURL" );
920 Irssi::settings_add_str( "twirssi", "twirssi_location",
921 ".irssi/scripts/twirssi.pl" );
922 Irssi::settings_add_str( "twirssi", "twitter_usernames", undef );
923 Irssi::settings_add_str( "twirssi", "twitter_passwords", undef );
924 Irssi::settings_add_str( "twirssi", "twirssi_replies_store",
925 ".irssi/scripts/twirssi.json" );
926 Irssi::settings_add_bool( "twirssi", "tweet_to_away", 0 );
927 Irssi::settings_add_bool( "twirssi", "show_reply_context", 0 );
928 Irssi::settings_add_bool( "twirssi", "show_own_tweets", 1 );
929 Irssi::settings_add_bool( "twirssi", "twirssi_debug", 0 );
930 Irssi::settings_add_bool( "twirssi", "twirssi_first_run", 1 );
931 Irssi::settings_add_bool( "twirssi", "twirssi_track_replies", 1 );
932 Irssi::settings_add_bool( "twirssi", "twirssi_use_reply_aliases", 0 );
933 Irssi::settings_add_bool( "twirssi", "tweet_window_input", 0 );
934 $window = Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
937 $window = Irssi::Windowitem::window_create (Irssi::settings_get_str('twitter_window'), 1);
938 $window->set_name (Irssi::settings_get_str('twitter_window'));
942 Irssi::command_bind( "dm", "cmd_direct" );
943 Irssi::command_bind( "dm_as", "cmd_direct_as" );
944 Irssi::command_bind( "tweet", "cmd_tweet" );
945 Irssi::command_bind( "tweet_as", "cmd_tweet_as" );
946 Irssi::command_bind( "twitter_reply", "cmd_reply" );
947 Irssi::command_bind( "twitter_reply_as", "cmd_reply_as" );
948 Irssi::command_bind( "twitter_login", "cmd_login" );
949 Irssi::command_bind( "twitter_logout", "cmd_logout" );
950 Irssi::command_bind( "twitter_switch", "cmd_switch" );
951 Irssi::command_bind( "twirssi_upgrade", "cmd_upgrade" );
952 if ( Irssi::settings_get_bool("twirssi_use_reply_aliases") ) {
953 Irssi::command_bind( "reply", "cmd_reply" );
954 Irssi::command_bind( "reply_as", "cmd_reply_as" );
959 print "twits: ", join ", ",
960 map { "u: $_->{username}" } values %twits;
961 print "friends: ", join ", ", sort keys %friends;
962 print "nicks: ", join ", ", sort keys %nicks;
963 print "id_map: ", Dumper \%{ $id_map{__indexes} };
964 print "last poll: $last_poll";
970 ¬ice("Twirssi v$VERSION (r$REV); "
971 . "Net::Twitter v$Net::Twitter::VERSION. "
973 . JSON::Any::handler()
974 . ". See details at http://twirssi.com/" );
980 "/twitter_friend <username>",
982 sub { ¬ice("Following $_[0]"); $nicks{ $_[0] } = time; }
988 "/twitter_unfriend <username>",
990 sub { ¬ice("Stopped following $_[0]"); delete $nicks{ $_[0] }; }
993 Irssi::command_bind( "twitter_updates", "get_updates" );
994 Irssi::signal_add_last( 'complete word' => \&sig_complete );
996 ¬ice(" %Y<%C(%B^%C)%N TWIRSSI v%R$VERSION%N (r$REV)");
997 ¬ice(" %C(_(\\%N http://twirssi.com/ for full docs");
999 " %Y||%C `%N Log in with /twitter_login, send updates with /tweet");
1001 my $file = Irssi::settings_get_str("twirssi_replies_store");
1002 if ( $file and -r $file ) {
1003 if ( open( JSON, $file ) ) {
1008 my $ref = JSON::Any->jsonToObj($json);
1010 my $num = keys %{ $id_map{__indexes} };
1011 ¬ice( sprintf "Loaded old replies from %d contact%s.",
1012 $num, ( $num == 1 ? "" : "s" ) );
1015 ¬ice("Failed to load old replies from $file: $!");
1019 if ( my $provider = Irssi::settings_get_str("short_url_provider") ) {
1020 eval "use WWW::Shorten::$provider;";
1024 "Failed to load WWW::Shorten::$provider - either clear short_url_provider or install the CPAN module"
1029 if ( my $autouser = Irssi::settings_get_str("twitter_usernames")
1030 and my $autopass = Irssi::settings_get_str("twitter_passwords") )
1037 ->print( "Create a window named "
1038 . Irssi::settings_get_str('twitter_window')
1039 . " or change the value of twitter_window. Then, reload twirssi." );