From 702399e09a32025f7dfed289735b064361263a6b Mon Sep 17 00:00:00 2001 From: mitty Date: Mon, 10 Jan 2011 06:55:26 +0000 Subject: [PATCH] * change skip flag logic * bot behavior and results are not changed git-svn-id: https://lab.mitty.jp/svn/lab/trunk@103 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- Dev/twitter/twitterbot.pl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Dev/twitter/twitterbot.pl b/Dev/twitter/twitterbot.pl index 870873c..9b9e2d8 100755 --- a/Dev/twitter/twitterbot.pl +++ b/Dev/twitter/twitterbot.pl @@ -48,29 +48,31 @@ my $tweets = {}; foreach my $id (sort keys %$tweets) { # $tweets->{$id}{type} eq 'search' => found by search API # eq 'mention' => found by mention API + my $skip; if ($tweets->{$id}{type} eq 'retweet') { DEBUG and warn "skipping $id that was already retweeted\n"; - next; + $skip = $id; } if (defined $conf->{allow}) { - my $flag; + $skip = $id; foreach my $screen_name ( @{ $conf->{allow}{screen_name} } ) { if ($tweets->{$id}{screen_name} eq $screen_name) { DEBUG and warn "$id was allowed by screen_name\n"; - $flag = $id; + undef $skip; last; } } foreach my $user_id ( @{ $conf->{allow}{user_id} } ) { if ($tweets->{$id}{user_id} eq $user_id) { DEBUG and warn "$id was allowed by user_id\n"; - $flag = $id; + undef $skip; last; } } - if (! $flag) { - next; - } + } + + if ($skip) { + next; } DEBUG or sleep($conf->{sleep}); -- 1.7.9.5