]> Sergey Matveev's repositories - public-inbox.git/commitdiff
watchmaildir: allow arguments for filters
authorEric Wong <e@80x24.org>
Wed, 25 Jan 2017 21:39:06 +0000 (21:39 +0000)
committerEric Wong <e@80x24.org>
Thu, 26 Jan 2017 03:22:54 +0000 (03:22 +0000)
We'll want to allow some degree of configuration for
various mailing lists.

lib/PublicInbox/WatchMaildir.pm

index 0b284bdba41bc5dcf0de46e0f8711a3f679ba3ea..1823c24862e6e6da36112ce86f123692f1b82e1d 100644 (file)
@@ -238,11 +238,17 @@ sub _scrubber_for {
        my ($inbox) = @_;
        my $f = $inbox->{filter};
        if ($f && $f =~ /::/) {
+               my @args;
+               # basic line splitting, only
+               # Perhaps we can have proper quote splitting one day...
+               ($f, @args) = split(/\s+/, $f) if $f =~ /\s+/;
+
                eval "require $f";
                if ($@) {
                        warn $@;
                } else {
-                       return $f->new;
+                       # e.g: PublicInbox::Filter::Vger->new(@args)
+                       return $f->new(@args);
                }
        }
        undef;