-my $fcfg = $dst->{filter} || '';
-my $filter;
-if ($fcfg =~ /::/) {
- eval "require $fcfg";
- die $@ if $@;
- $filter = $fcfg->new;
-} elsif ($fcfg eq 'scrub') { # TODO:
- require PublicInbox::Filter::Mirror;
- $filter = PublicInbox::Filter::Mirror->new;
-} else {
- $filter = PublicInbox::Filter::Base->new;
+$do_exit->(67) if $err && scalar(@$dests) == 0;
+
+$eml = undef;
+my $spam_ok;
+if ($spamc) {
+ $str = '';
+ $spam_ok = $spamc->spamcheck($ems->fh, \$str);
+ # update the emergency dump with the new message:
+ $emm = PublicInbox::Emergency->new($emergency);
+ $emm->prepare(\$str);
+ $ems = $ems->abort;
+} else { # no spam checking configured:
+ $spam_ok = 1;
+ $emm = $ems;
+ my $fh = $emm->fh;
+ read($fh, $str, -s $fh);
+}
+$do_exit->(0) unless $spam_ok;
+
+# -mda defaults to the strict base filter which we won't use anywhere else
+sub mda_filter_adjust ($) {
+ my ($ibx) = @_;
+ my $fcfg = $ibx->{filter} || '';
+ if ($fcfg eq '') {
+ $ibx->{filter} = 'PublicInbox::Filter::Base';
+ } elsif ($fcfg eq 'scrub') { # legacy alias, undocumented, remove?
+ $ibx->{filter} = 'PublicInbox::Filter::Mirror';
+ }