]> diplodocus.org Git - minc/commitdiff
New option -p. Using this option causes minc to print the filename
authorepg <>
Sat, 26 Apr 2003 06:48:34 +0000 (06:48 +0000)
committerepg <>
Sat, 26 Apr 2003 06:48:34 +0000 (06:48 +0000)
for each message before checking it for spam, which is useful for
debugging the spam filter.

minc

diff --git a/minc b/minc
index 79a85e2..b74ecd4 100755 (executable)
--- a/minc
+++ b/minc
@@ -68,6 +68,12 @@ Show help.
 Dry run; do not actually incorporate the mail, but log and report to
 stdout/stderr as normal.
 
+=item B<-p>
+
+Print the filename of each message before checking it for spam.  This
+can be handy if a particular message is giving the spam checker a
+problem.
+
 =item B<-s>
 
 Process SPAM only, then exit, leaving all non-spam messages in the
@@ -80,15 +86,17 @@ maildir.
 my $dumpfilters = 0;
 my $filteronly = 0;
 our $run = 1;
+my $printfilenames = 0;
 my $spamonly = 0;
 
 our $opt_d;
 our $opt_f;
 our $opt_h;
 our $opt_n;
+our $opt_p;
 our $opt_s;                     # ;; # stupid cperl-mode
 
-if (not getopts('dfhns')) {
+if (not getopts('dfhnps')) {
     exit(&EX_USAGE);
 }
 
@@ -101,6 +109,10 @@ if ($opt_d) {
     $run = 0;
 }
 
+if ($opt_p) {
+    $printfilenames = 1;
+}
+
 if ($opt_f) {
     $filteronly = 1;
 } elsif ($opt_s) {              # ))){ # stupid cperl-mode
@@ -568,6 +580,9 @@ sub kill_spam {
     foreach $msg (@msglist) {
         printf('%sChecking for spam... %6d/%d',
                "\r", ++$i, scalar(@msglist));
+        if ($printfilenames) {
+            print($msg);
+        }
         if (spam_check($msg, @baton)) {
             print(" SPAM\n");
             store_message($msg, 'SPAM');