- 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);
- }
+$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);