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 --- t/watch_maildir_v2.t | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 't/watch_maildir_v2.t') diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t index 0a5a8017..99551ceb 100644 --- a/t/watch_maildir_v2.t +++ b/t/watch_maildir_v2.t @@ -171,4 +171,35 @@ EOF is($both, $$msg, 'got original message back from v2'); } +{ + my $want = <<'EOF'; +From: +List-Id: +Message-ID: +EOF + my $do_not_want = <<'EOF'; +From: +List-Id: +X-Mailing-List: no@example.com +Message-ID: +EOF + my $cfg = $orig."$cfgpfx.listid=i.want.you.to.want.me\n"; + PublicInbox::Emergency->new($maildir)->prepare(\$want); + PublicInbox::Emergency->new($maildir)->prepare(\$do_not_want); + my $config = PublicInbox::Config->new(\$cfg); + PublicInbox::WatchMaildir->new($config)->scan('full'); + $ibx = $config->lookup_name('test'); + my $num = $ibx->mm->num_for('do.want@example.com'); + ok(defined $num, 'List-ID matched for watch'); + $num = $ibx->mm->num_for('do.not.want@example.com'); + is($num, undef, 'unaccepted List-ID matched for watch'); + + $cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n"; + $config = PublicInbox::Config->new(\$cfg); + PublicInbox::WatchMaildir->new($config)->scan('full'); + $ibx = $config->lookup_name('test'); + $num = $ibx->mm->num_for('do.not.want@example.com'); + ok(defined $num, 'X-Mailing-List matched'); +} + done_testing; -- cgit v1.2.3-24-ge0c7