X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/blobdiff_plain/9f73fa0dc6d86b68bd6dc293600d44f6832258ef..20f3d445b86fefb0b81d6ce8a3d04a7fca410488:/twirssi.pl diff --git a/twirssi.pl b/twirssi.pl index b77aa73..6a19972 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -10,8 +10,8 @@ $Data::Dumper::Indent = 1; use vars qw($VERSION %IRSSI); -$VERSION = "2.2.3beta"; -my ($REV) = '$Rev: 618 $' =~ /(\d+)/; +$VERSION = "2.2.5beta"; +my ($REV) = '$Rev: 659 $' =~ /(\d+)/; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@ -20,7 +20,7 @@ my ($REV) = '$Rev: 618 $' =~ /(\d+)/; . 'Can optionally set your bitlbee /away message to same', license => 'GNU GPL v2', url => 'http://twirssi.com', - changed => '$Date: 2009-04-22 16:03:14 -0700 (Wed, 22 Apr 2009) $', + changed => '$Date: 2009-07-02 12:48:40 -0700 (Thu, 02 Jul 2009) $', ); my $window; @@ -183,7 +183,7 @@ sub cmd_retweet_as { $twits{$username}->update( { status => $data, - in_reply_to_status_id => $id_map{ lc $nick }[$id] + # in_reply_to_status_id => $id_map{ lc $nick }[$id] } ) ) @@ -527,7 +527,7 @@ sub cmd_login { ¬ice("Welcome to twirssi!" . " Perhaps you should add \@twirssi to your friends list," . " so you can be notified when a new version is release?" - . " Just type /twitter_friend twirssi." ); + . " Just type /twitter_follow twirssi." ); } } %nicks = %friends; @@ -801,6 +801,8 @@ sub get_updates { } close $fh; exit; + } else { + &ccrap("Failed to fork for updating: $!"); } print scalar localtime, " - get_updates ends" if &debug; } @@ -876,7 +878,7 @@ sub do_updates { " -- http://twitter.com/$context->{user}{screen_name}" . "/status/$context->{id}"; } - printf $fh "id:%d account:%s nick:%s type:tweet %s\n", + printf $fh "id:%u account:%s nick:%s type:tweet %s\n", $context->{id}, $username, $context->{user}{screen_name}, $ctext; $reply = "reply"; @@ -889,11 +891,11 @@ sub do_updates { $text .= " -- http://twitter.com/$t->{user}{screen_name}" . "/status/$t->{id}"; } - printf $fh "id:%d account:%s nick:%s type:%s %s\n", + printf $fh "id:%u account:%s nick:%s type:%s %s\n", $t->{id}, $username, $t->{user}{screen_name}, $reply, $text; $new_poll_id = $t->{id} if $new_poll_id < $t->{id}; } - printf $fh "id:%d account:%s type:last_id timeline\n", + printf $fh "id:%u account:%s type:last_id timeline\n", $new_poll_id, $username; print scalar localtime, " - Polling for replies" if &debug; @@ -924,11 +926,11 @@ sub do_updates { $text .= " -- http://twitter.com/$t->{user}{screen_name}" . "/status/$t->{id}"; } - printf $fh "id:%d account:%s nick:%s type:tweet %s\n", + printf $fh "id:%u account:%s nick:%s type:tweet %s\n", $t->{id}, $username, $t->{user}{screen_name}, $text; $new_poll_id = $t->{id} if $new_poll_id < $t->{id}; } - printf $fh "id:%d account:%s type:last_id reply\n", $new_poll_id, $username; + printf $fh "id:%u account:%s type:last_id reply\n", $new_poll_id, $username; print scalar localtime, " - Polling for DMs" if &debug; $new_poll_id = 0; @@ -951,11 +953,11 @@ sub do_updates { foreach my $t ( reverse @$tweets ) { my $text = decode_entities( $t->{text} ); $text = &hilight($text); - printf $fh "id:%d account:%s nick:%s type:dm %s\n", + printf $fh "id:%u account:%s nick:%s type:dm %s\n", $t->{id}, $username, $t->{sender_screen_name}, $text; $new_poll_id = $t->{id} if $new_poll_id < $t->{id}; } - printf $fh "id:%d account:%s type:last_id dm\n", $new_poll_id, $username; + printf $fh "id:%u account:%s type:last_id dm\n", $new_poll_id, $username; print scalar localtime, " - Polling for subscriptions" if &debug; if ( $obj->can('search') and $id_map{__searches}{$username} ) { @@ -985,13 +987,13 @@ sub do_updates { } $id_map{__searches}{$username}{$topic} = $search->{max_id}; - printf $fh "id:%d account:%s type:searchid topic:%s\n", + printf $fh "id:%u account:%s type:searchid topic:%s\n", $search->{max_id}, $username, $topic; foreach my $t ( reverse @{ $search->{results} } ) { my $text = decode_entities( $t->{text} ); $text = &hilight($text); - printf $fh "id:%d account:%s nick:%s type:search topic:%s %s\n", + printf $fh "id:%u account:%s nick:%s type:search topic:%s %s\n", $t->{id}, $username, $t->{from_user}, $topic, $text; $new_poll_id = $t->{id} if not $new_poll_id @@ -1077,8 +1079,7 @@ sub monitor_child { my $hilight_color = $irssi_to_mirc_colors{ Irssi::settings_get_str("hilight_color") }; - my $nick = - '@' . substr( $meta{account}, 0, index( $meta{account}, "@" ) ); + my $nick = "\@$meta{account}"; if ( $_ =~ /\Q$nick\E(?:\W|$)/i and Irssi::settings_get_bool("twirssi_hilights") ) { @@ -1240,7 +1241,10 @@ sub monitor_child { } $failwhale = 1; } - &ccrap("Haven't been able to get updated tweets since $since"); + + if ( time - $last_poll < 600 ) { + &ccrap("Haven't been able to get updated tweets since $since"); + } } } @@ -1378,7 +1382,7 @@ sub hilight { if ( Irssi::settings_get_str("twirssi_topic_color") ) { my $c = Irssi::settings_get_str("twirssi_topic_color"); $c = $irssi_to_mirc_colors{$c}; - $text =~ s/(^|\W)\#([-\w]+)/$1\cC$c\#$2\cO/g if $c; + $text =~ s/(^|\W)(\#|\!)([-\w]+)/$1\cC$c$2$3\cO/g if $c; } $text =~ s/[\n\r]/ /g; @@ -1528,6 +1532,7 @@ if ($window) { Irssi::command_bind( "twitter_list_subscriptions", "cmd_list_search" ); Irssi::command_bind( "twirssi_upgrade", "cmd_upgrade" ); Irssi::command_bind( "twitter_updates", "get_updates" ); + Irssi::command_bind( "bitlbee_away", "update_away" ); if ( Irssi::settings_get_bool("twirssi_use_reply_aliases") ) { Irssi::command_bind( "reply", "cmd_reply" ); Irssi::command_bind( "reply_as", "cmd_reply_as" ); @@ -1560,15 +1565,15 @@ if ($window) { } ); Irssi::command_bind( - "twitter_friend", + "twitter_follow", &gen_cmd( - "/twitter_friend ", + "/twitter_follow ", "create_friend", sub { ¬ice("Following $_[0]"); $nicks{ $_[0] } = time; } ) ); Irssi::command_bind( - "twitter_unfriend", + "twitter_unfollow", &gen_cmd( "/twitter_unfriend ", "destroy_friend",