X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/blobdiff_plain/c69f1cef391929878470a3841232efb34a876ba8..1da24996a0415d1db4c6e971ec8b4e8f7f965b81:/twirssi.pl diff --git a/twirssi.pl b/twirssi.pl index 3d292f4..267db11 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -7,6 +7,7 @@ use File::Temp; use LWP::Simple; use Data::Dumper; use Encode; +use POSIX qw/:sys_wait_h/; $Data::Dumper::Indent = 1; use vars qw($VERSION %IRSSI); @@ -968,7 +969,7 @@ sub do_updates { } foreach my $t ( reverse @$tweets ) { - my $text = &get_text($t, $obj); + my $text = &get_text( $t, $obj ); my $reply = "tweet"; if ( Irssi::settings_get_bool("show_reply_context") and $t->{in_reply_to_screen_name} ne $username @@ -1185,6 +1186,9 @@ sub monitor_child { if &debug; my ($new_last_poll); + # reap any random leftover processes - work around a bug in irssi on gentoo + waitpid(-1, WNOHANG); + # first time we run we don't want to print out *everything*, so we just # pretend @@ -1659,16 +1663,15 @@ sub normalize_username { } sub get_text { - my $tweet = shift; + my $tweet = shift; my $object = shift; - my $text = decode_entities( $tweet->{text} ); - if ($tweet->{truncated}) { - if (exists $tweet->{retweeted_status}) { - $text = "RT $tweet->{retweeted_status}{user}{screen_name}: " . - "$tweet->{retweeted_status}{text}"; + my $text = decode_entities( $tweet->{text} ); + if ( $tweet->{truncated} ) { + if ( exists $tweet->{retweeted_status} ) { + $text = "RT \@$tweet->{retweeted_status}{user}{screen_name}: " + . "$tweet->{retweeted_status}{text}"; } elsif ( $object->isa('Net::Twitter') ) { - $text .= - " -- http://twitter.com/$tweet->{user}{screen_name}" + $text .= " -- http://twitter.com/$tweet->{user}{screen_name}" . "/status/$tweet->{id}"; } }