lib/PublicInbox/Config.pm | 2 +- public-inbox-mda | 13 ++++++++++++- diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 315d788b8f3a508ed8fb53a03cafe2fdc1ad9812..0d73a867059f468c1e936d79d0a9a2102a5e3d61 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -61,7 +61,7 @@ defined $pfx or return; my %rv; - foreach my $k (qw(mainrepo address)) { + foreach my $k (qw(mainrepo address filter)) { my $v = $self->{"$pfx.$k"}; $rv{$k} = $v if defined $v; } diff --git a/public-inbox-mda b/public-inbox-mda index 1a9469badfecd1c179601d5d7f7cba48b718ccc6..df8ca38c13ff3d93d59765e0dd5751dc45d599ee 100755 --- a/public-inbox-mda +++ b/public-inbox-mda @@ -38,7 +38,18 @@ my $msg = Email::MIME->new(\$filtered); $filtered = undef; $filter->simple($msg); - if (PublicInbox::Filter->run($msg, $filter)) { + my $filter_arg; + my $fcfg = $dst->{filter}; + if (!defined $fcfg || $filter eq 'reject') { + $filter_arg = $filter; + } elsif ($fcfg eq 'scrub') { + $filter_arg = undef; # the default for legacy versions + } else { + warn "publicinbox.$dst->{listname}.filter=$fcfg invalid\n"; + warn "must be either 'scrub' or 'reject' (the default)\n"; + } + + if (PublicInbox::Filter->run($msg, $filter_arg)) { # run spamc again on the HTML-free message if (do_spamc($msg, \$filtered)) { $msg = Email::MIME->new(\$filtered);