- END {
- index_sync($main_repo) if ($? == 0);
- };
- my $git = PublicInbox::Git->new($main_repo);
- my $im = PublicInbox::Import->new($git,
- $dst->{listname}, $recipient);
- if (defined $im->add($msg)) {
- $im->done;
- $filter->ignore; # exits
- }
- # this message is similar to what ssoma-mda shows:
- print STDERR "CONFLICT: Message-ID: ",
- $msg->header_obj->header_raw('Message-ID'),
- " exists\n";
- }
- }
-} else {
- # Ensure emergency spam gets spamassassin headers.
- # This makes it easier to prioritize obvious spam from less obvious
- if (defined($filtered) && $filtered ne '') {
- my $drop = Email::MIME->new(\$filtered);
- $filtered = undef;
- $filter->simple($drop);
+$simple = 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';