use vars qw($VERSION %IRSSI);
-$VERSION = "1.5";
-my ($REV) = '$Rev: 318 $' =~ /(\d+)/;
+$VERSION = "1.5.3";
+my ($REV) = '$Rev: 331 $' =~ /(\d+)/;
%IRSSI = (
authors => 'Dan Boger',
contact => 'zigdon@gmail.com',
$p = shift @pass;
&cmd_login("$u $p");
}
+ return;
}
} else {
¬ice("/twitter_login requires either a username and password "
$friends = $twit->friends( page => $page );
}
+ my ($added, $removed) = (0, 0);
foreach ( keys %new_friends ) {
next if exists $friends{$_};
$friends{$_} = time;
+ $added++;
}
foreach ( keys %friends ) {
- delete $friends{$_} unless exists $new_friends{$_};
+ next if exists $new_friends{$_};
+ delete $friends{$_};
+ $removed++;
}
+
+ return ($added, $removed);
}
sub get_updates {
if ($pid) { # parent
Irssi::timeout_add_once( 5000, 'monitor_child', [$filename] );
+ Irssi::pidwait_add($pid);
} elsif ( defined $pid ) { # child
close STDIN;
close STDOUT;
&do_updates( $fh, $_, $twits{$_} );
}
+ my ($added, $removed) = &load_friends;
+ if ($added + $removed) {
+ print $fh "%R***%n Friends list updated: ",
+ join(", ", sprintf("%d added", $added),
+ sprintf("%d removed", $removed)), "\n";
+ }
print $fh "__friends__\n";
- &load_friends;
foreach ( sort keys %friends ) {
print $fh "$_ $friends{$_}\n";
}
my ( $complist, $window, $word, $linestart, $want_space ) = @_;
return unless $linestart =~ /^\/(?:tweet|dm)/;
- return if $linestart eq '/tweet' and $word !~ s/^@//;
+ my $prefix = $word =~ s/^@//;
+ $prefix = 0 if $linestart eq '/dm' or $linestart eq '/dm_as';
push @$complist, grep /^\Q$word/i,
sort { $nicks{$b} <=> $nicks{$a} } keys %nicks;
- @$complist = map { "\@$_" } @$complist if $linestart eq '/tweet';
+ @$complist = map { "\@$_" } @$complist if $prefix;
}
Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" );