This file is Perl code (included via the 'require' directive) which is
expected to define the FILTERS hash.
+=item $HOME/.mincspam
+
+If this file exists, minc will include it with the expectation that it
+will define a B<is_spam> function. This function takes a message
+filename as an argument and returns 1 if the message is spam, else 0.
+If this file does not exist, minc will define a simple function that
+always returns 0.
+
+XXX: need more details about the spam-handling process; for now read
+the code.
+
=item `mhpath +`/logs/minc.log
Where minc logs what it does, unless in -n mode.
our %FILTERS;
require "$HOME/.mincfilter";
+if (-f "$HOME/.mincspam") {
+ require "$HOME/.mincspam";
+} else {
+ sub is_spam {
+ return 0;
+ }
+}
+
my $mh;
my $logfile;
return %headers;
}
-\f
###############################################################################
# Spam handling
-sub is_spam {
- my $msg = shift;
- my $err;
- my $sig;
- my $line;
- my $message;
- my $status;
-
- $err = $sig = $msg;
- $err =~ s|/new/|/err/|;
- $sig =~ s|/new/|/sig/|;
- if (-f $err) {
- open(ERR, $err);
- $line = <ERR>;
- close(ERR);
-
- chomp($line);
- ($message, $!) = split(/:/, $line);
-
- logerr("$err: $message: $!");
-
- if ($run) {
- if (unlink($err) != 1) {
- err(&EX_OSERR, "Failed unlink($err)");
- }
- }
- } elsif (-f $sig) {
- # This is supposed to be a signature created with razor-check
- # directly after delivery. Currently this isn't supported
- # because it isn't clear to me how to get that signature back
- # into razor-check. For now, just unlink any sig files we
- # find and proceed with full razor-check mode.
-
- if ($run) {
- if (unlink($sig) != 1) {
- err(&EX_OSERR, "Failed unlink($sig)");
- }
- }
- }
-
- if ($run) {
- $status = system("razor-check < $msg");
- if (not WIFEXITED($status)) {
- err(&EX_OSERR, "Failed to run razor-check < $msg");
- } elsif (WEXITSTATUS($status) == 0) {
- return 1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
-}
-
sub kill_spam {
my @msglist = @_;
my @result;