]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: support loading arbitrary filters
authorEric Wong <e@80x24.org>
Thu, 16 Jun 2016 22:45:27 +0000 (22:45 +0000)
committerEric Wong <e@80x24.org>
Fri, 17 Jun 2016 01:13:57 +0000 (01:13 +0000)
Give users some rope to do their own filtering.

script/public-inbox-mda

index 63096fee9a8812fe13f30010437a9b89b75d5305..26b70cfb6cfc8f2fc7d4631b829648e0e34d068f 100755 (executable)
@@ -57,7 +57,11 @@ do_exit(0) unless $spam_ok;
 
 my $fcfg = $dst->{filter} || '';
 my $filter;
-if ($fcfg eq 'scrub') { # TODO:
+if ($fcfg =~ /::/) {
+       eval "require $fcfg";
+       die $@ if $@;
+       $filter = $fcfg->new;
+} elsif ($fcfg eq 'scrub') { # TODO:
        require PublicInbox::Filter::Mirror;
        $filter = PublicInbox::Filter::Mirror->new;
 } else {