about summary refs log tree commit homepage
path: root/script/public-inbox-mda
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-28 10:45:22 +0000
committerEric Wong <e@80x24.org>2019-10-30 08:48:17 +0000
commit420fddb8b683637cc1fd39727896cac4a459c3b6 (patch)
tree52fb94de37a696de3576a073bdcea0dc687e84cb /script/public-inbox-mda
parent84d811cfb3a0c8724c52ce485402e4586d5c9e04 (diff)
downloadpublic-inbox-420fddb8b683637cc1fd39727896cac4a459c3b6.tar.gz
It makes it easier to document the default -mda behavior is
stricter than normal, including "public-inbox-learn ham"
Diffstat (limited to 'script/public-inbox-mda')
-rwxr-xr-xscript/public-inbox-mda18
1 files changed, 12 insertions, 6 deletions
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 3ff318c9..71c5d937 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -75,13 +75,19 @@ if ($spamc) {
 my $mime = PublicInbox::MIME->new(\$str);
 do_exit(0) unless $spam_ok;
 
-my $fcfg = $dst->{filter} || '';
-# -mda defaults to the strict base filter
-if ($fcfg eq '') {
-        $dst->{filter} = 'PublicInbox::Filter::Base';
-} elsif ($fcfg eq 'scrub') { # legacy alias, undocumented, remove?
-        $dst->{filter} = 'PublicInbox::Filter::Mirror';
+# -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';
+        }
 }
+
+mda_filter_adjust($dst);
+
 my $filter = $dst->filter;
 my $ret = $filter->delivery($mime);
 if (ref($ret) && $ret->isa('Email::MIME')) { # filter altered message