about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-15 03:40:19 +0000
committerEric Wong <e@80x24.org>2019-10-15 20:26:41 +0000
commit7e881ac8227d1882c92de6f6701ffcba7cef9191 (patch)
tree771d41fc13cbbb894d92abccfb87a68ac67949a4 /script
parent849f57851a04e376cf2327d9e98e8128bf3c756e (diff)
downloadpublic-inbox-7e881ac8227d1882c92de6f6701ffcba7cef9191.tar.gz
This also adds watchheader tests for -watch, which we never
had before :x
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-mda17
1 files changed, 14 insertions, 3 deletions
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 4e6e04e2..2655a6c5 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -36,10 +36,21 @@ my $config = PublicInbox::Config->new;
 my $key = 'publicinboxmda.spamcheck';
 my $default = 'PublicInbox::Spamcheck::Spamc';
 my $spamc = PublicInbox::Spamcheck::get($config, $key, $default);
+my $dst;
 my $recipient = $ENV{ORIGINAL_RECIPIENT};
-defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n";
-my $dst = $config->lookup($recipient); # first check
-defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown
+if (defined $recipient) {
+        $dst = $config->lookup($recipient); # first check
+}
+if (!defined $dst) {
+        my $list_id = $simple->header('List-Id');
+        if (defined $list_id && $list_id =~ /<[ \t]*(.+)?[ \t]*>/) {
+                $dst = $config->lookup_list_id($1);
+        }
+        if (!defined $dst && !defined $recipient) {
+                die "ORIGINAL_RECIPIENT not defined in ENV\n";
+        }
+        defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown
+}
 $dst->{mainrepo} or do_exit(67);
 $dst = PublicInbox::InboxWritable->new($dst);