From 7e881ac8227d1882c92de6f6701ffcba7cef9191 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 15 Oct 2019 03:40:19 +0000 Subject: mda, watch: wire up List-ID header support This also adds watchheader tests for -watch, which we never had before :x --- script/public-inbox-mda | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'script/public-inbox-mda') 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); -- cgit v1.2.3-24-ge0c7