* change skip flag logic
[lab.git] / Dev / twitter / twitterbot.pl
index 870873c..9b9e2d8 100755 (executable)
@@ -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});