X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=script%2Fpublic-inbox-mda;h=7e2bee92096e877ae40e34eb847e8149f933eb2e;hb=d1fd2feb587b34d66227a6cb4f9c8b930812ddbf;hp=42d0e00cbb72687bbdaf5e67e1fb0c6c379ba9b1;hpb=46742d95647c7a80cb2f60d5c134717dd91e22e2;p=public-inbox.git
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 42d0e00c..7e2bee92 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -1,13 +1,23 @@
#!/usr/bin/perl -w
-# Copyright (C) 2013-2020 all contributors
+# Copyright (C) 2013-2021 all contributors
# License: AGPL-3.0+
#
# Mail delivery agent for public-inbox, run from your MTA upon mail delivery
+my $help = < \$precheck, 'help|h' => \$show_help) or
+ do { print STDERR $help; exit 1 };
my $do_exit = sub {
my ($code) = shift;
@@ -32,18 +42,18 @@ my $str = do { local $/; };
$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
$ems->prepare(\$str);
my $eml = PublicInbox::Eml->new(\$str);
-my $config = PublicInbox::Config->new;
+my $cfg = PublicInbox::Config->new;
my $key = 'publicinboxmda.spamcheck';
my $default = 'PublicInbox::Spamcheck::Spamc';
-my $spamc = PublicInbox::Spamcheck::get($config, $key, $default);
+my $spamc = PublicInbox::Spamcheck::get($cfg, $key, $default);
my $dests = [];
my $recipient = $ENV{ORIGINAL_RECIPIENT};
if (defined $recipient) {
- my $ibx = $config->lookup($recipient); # first check
+ my $ibx = $cfg->lookup($recipient); # first check
push @$dests, $ibx if $ibx;
}
if (!scalar(@$dests)) {
- $dests = PublicInbox::MDA->inboxes_for_list_id($config, $eml);
+ $dests = PublicInbox::MDA->inboxes_for_list_id($cfg, $eml);
if (!scalar(@$dests) && !defined($recipient)) {
die "ORIGINAL_RECIPIENT not defined in ENV\n";
}
@@ -119,7 +129,7 @@ for my $ibx (@$dests) {
# destination succeeds
$emm->abort;
} else { # v1-only
- my $mid = $mime->header_obj->header_raw('Message-ID');
+ my $mid = $mime->header_raw('Message-ID');
# this message is similar to what ssoma-mda shows:
print STDERR "CONFLICT: Message-ID: $mid exists\n";
}