X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/blobdiff_plain/2eb757f9d7d9027a1d11e662a72a461b4c3a7917..c8395e2cae3541eae8f929046c2244a3c365d976:/twirssi.pl diff --git a/twirssi.pl b/twirssi.pl index 93cb896..76892c3 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -10,7 +10,7 @@ use vars qw($VERSION %IRSSI); use constant { DEBUG => 0 }; $VERSION = "1.1"; -my $REV = '$Rev: 300 $'; +my ($REV) = '$Rev: 303 $' =~ /(\d+)/; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@ -150,6 +150,7 @@ sub cmd_login { ¬ice("Logged in as $user, loading friends list..."); &load_friends; ¬ice( "loaded friends: ", scalar keys %nicks ); + %nicks = %friends; $nicks{$user} = 0; &get_updates; } else { @@ -163,7 +164,7 @@ sub load_friends { while (1) { my $friends = $twit->friends( { page => $page } ); last unless $friends; - $new_friends{ $_->{screen_name} } = $nicks{ $_->{screen_name} } = time + $new_friends{ $_->{screen_name} } = time foreach @$friends; $page++; last if @$friends == 0 or $page == 10; @@ -264,7 +265,7 @@ sub get_updates { $text; } print scalar localtime, " - Done" if DEBUG; - print $fh "--friends:\n"; + print $fh "__friends__\n"; &load_friends; foreach (sort keys %friends) { print $fh "$_ $friends{$_}\n"; @@ -284,7 +285,8 @@ sub monitor_child { my @lines; while () { chomp; - push @lines, $_ unless /^--friends:$/; + last if /^__friends__/; + push @lines, $_ unless /^__friends__/; } %friends = (); @@ -294,7 +296,7 @@ sub monitor_child { last; } my ($f, $t) = split ' ', $_; - $friends{$f} = $t; + $nicks{$f} = $friends{$f} = $t; } print "new last_poll = $last_poll" if DEBUG;