]> pere.pagekite.me Git - homepage.git/commitdiff
Implement more.
authorPetter Reinholdtsen <pere@hungry.com>
Wed, 28 Dec 2005 18:39:06 +0000 (18:39 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Wed, 28 Dec 2005 18:39:06 +0000 (18:39 +0000)
linux/gmanespam

index d0c5d944448b0edbd5891b7ebdb86bd8ab7a1787..69e2f8537c355c3e1dd0eba21a7467b6b8e92419 100644 (file)
@@ -97,8 +97,8 @@ sub process_gmane_group {
     my @spammsgs;
 
     print "\n$groupname: $msgfirst -> $msglast ($msgcount)\n";
-
-    while (++$curmsgnum <= $msglast) {
+    my $aktive = 1;
+    while ($aktive && ++$curmsgnum <= $msglast) {
         print "\n[$curmsgnum/$msglast] ============ $groupname ===========\n";
 
         my $headersref = $nntp->head($curmsgnum);
@@ -114,7 +114,7 @@ sub process_gmane_group {
             print "**** Message already flagged as spam.  Ignoring.\n";
             next;
         }
-        print "Non-spam/Spam/view Body/view Full/jump #/Help/Quit [N] ? ";
+        print "Non-spam/Spam/sKip/view Body/view Full/jump #/Help/Quit [N] ? ";
         my $input = <>;
         chomp $input;
         $input = "\L$input";
@@ -132,17 +132,47 @@ sub process_gmane_group {
             $curmsgnum = $msglast if $curmsgnum > $msglast;
             print "Jumping to message number $1\n";
             next;
+       } elsif ("k" eq $input) {
+           # Skip this group and move to the next group
+           $aktive = 0;
+       } elsif ("f" eq $input) {
+           # View message header and body
+           my $articleref = $nntp->article($curmsgnum);
+           list_lines($articleref);
+           $curmsgnum--;
+       } elsif ("b" eq $input) {
+           # View message body
+           my $bodyref = $nntp->body($curmsgnum);
+           list_lines($bodyref);
+           $curmsgnum--;
+       } elsif ("h" eq $input) {
+           # print help
         } else {
             print STDERR "error: Unhandled choice '$input'\n";
         }
     }
-    for my $msgnum (@spammsgs) {
-        report_spam($groupname, $msgnum);
+    if (@spammsgs) {
+       print "Submit changes? [yes] ";
+       my $input = <>;
+       chomp $input;
+       $input = "\L$input";
+       if ("" eq $input || "yes" eq $input) {
+           for my $msgnum (@spammsgs) {
+               report_spam($groupname, $msgnum);
+           }
+       }
     }
     $grouplast{$groupname} = --$curmsgnum;
     print "Storing $curmsgnum as last read message in $groupname\n";
 }
 
+sub list_lines {
+    my $arrayref = shift;
+    for (@{$arrayref}) {
+       print "  ", $_;
+    }
+}
+
 sub process_header {
     my $headerref = shift;
     my $subject;