]> Sergey Matveev's repositories - public-inbox.git/commitdiff
rename WatchMaildir => Watch
authorEric Wong <e@yhbt.net>
Mon, 31 Aug 2020 04:41:32 +0000 (04:41 +0000)
committerEric Wong <e@80x24.org>
Tue, 1 Sep 2020 00:19:03 +0000 (00:19 +0000)
This is no longer limited to Maildirs now that IMAP and NNTP
support exist; so give it a shorter name.

MANIFEST
lib/PublicInbox/Watch.pm [moved from lib/PublicInbox/WatchMaildir.pm with 99% similarity]
script/public-inbox-watch
t/imapd.t
t/nntpd.t
t/watch_filter_rubylang.t
t/watch_imap.t
t/watch_maildir.t
t/watch_maildir_v2.t
t/watch_multiple_headers.t
t/watch_nntp.t

index 35adc8d3271624c50079284702a4a6e1af63c6b2..f090175e7270a57e89839981748aa3b5d12c2521 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -200,7 +200,7 @@ lib/PublicInbox/ViewDiff.pm
 lib/PublicInbox/ViewVCS.pm
 lib/PublicInbox/WWW.pm
 lib/PublicInbox/WWW.pod
 lib/PublicInbox/ViewVCS.pm
 lib/PublicInbox/WWW.pm
 lib/PublicInbox/WWW.pod
-lib/PublicInbox/WatchMaildir.pm
+lib/PublicInbox/Watch.pm
 lib/PublicInbox/WwwAltId.pm
 lib/PublicInbox/WwwAtomStream.pm
 lib/PublicInbox/WwwAttach.pm
 lib/PublicInbox/WwwAltId.pm
 lib/PublicInbox/WwwAtomStream.pm
 lib/PublicInbox/WwwAttach.pm
similarity index 99%
rename from lib/PublicInbox/WatchMaildir.pm
rename to lib/PublicInbox/Watch.pm
index 1c7ac6c0df67baf83a604a7cc443d62ce858a0d6..5f78613961db1058506b8193c4ea7bd55c0522f3 100644 (file)
@@ -3,7 +3,7 @@
 #
 # ref: https://cr.yp.to/proto/maildir.html
 #      http://wiki2.dovecot.org/MailboxFormat/Maildir
 #
 # ref: https://cr.yp.to/proto/maildir.html
 #      http://wiki2.dovecot.org/MailboxFormat/Maildir
-package PublicInbox::WatchMaildir;
+package PublicInbox::Watch;
 use strict;
 use v5.10.1;
 use PublicInbox::Eml;
 use strict;
 use v5.10.1;
 use PublicInbox::Eml;
index 20534bf2a3ec196e36cdd3c9d2bb0c6136fba849..0249186000b6ee47ea45cd5d03e50a49e04bf333 100755 (executable)
@@ -3,7 +3,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use IO::Handle;
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use IO::Handle;
-use PublicInbox::WatchMaildir;
+use PublicInbox::Watch;
 use PublicInbox::Config;
 use PublicInbox::DS;
 use PublicInbox::Sigfd;
 use PublicInbox::Config;
 use PublicInbox::DS;
 use PublicInbox::Sigfd;
@@ -11,18 +11,18 @@ use PublicInbox::Syscall qw($SFD_NONBLOCK);
 my $oldset = PublicInbox::Sigfd::block_signals();
 STDOUT->autoflush(1);
 STDERR->autoflush(1);
 my $oldset = PublicInbox::Sigfd::block_signals();
 STDOUT->autoflush(1);
 STDERR->autoflush(1);
-my ($config, $watch_md);
+my ($config, $watch);
 my $reload = sub {
        $config = PublicInbox::Config->new;
 my $reload = sub {
        $config = PublicInbox::Config->new;
-       $watch_md->quit if $watch_md;
-       $watch_md = PublicInbox::WatchMaildir->new($config);
+       $watch->quit if $watch;
+       $watch = PublicInbox::Watch->new($config);
 };
 $reload->();
 };
 $reload->();
-if ($watch_md) {
-       my $scan = sub { $watch_md->trigger_scan('full') if $watch_md };
+if ($watch) {
+       my $scan = sub { $watch->trigger_scan('full') if $watch };
        my $quit = sub {
        my $quit = sub {
-               $watch_md->quit if $watch_md;
-               $watch_md = undef;
+               $watch->quit if $watch;
+               $watch = undef;
        };
        my $sig = {
                HUP => $reload,
        };
        my $sig = {
                HUP => $reload,
@@ -41,5 +41,5 @@ if ($watch_md) {
                PublicInbox::Sigfd::set_sigmask($oldset);
                PublicInbox::DS->SetLoopTimeout(1000);
        }
                PublicInbox::Sigfd::set_sigmask($oldset);
                PublicInbox::DS->SetLoopTimeout(1000);
        }
-       $watch_md->watch($sig, $oldset) while ($watch_md);
+       $watch->watch($sig, $oldset) while ($watch);
 }
 }
index 8db72bd7bff43caf4ea91880a85c6a3af54bfb68..f743bf06852176616b81f3825ee35e38d052f12a 100644 (file)
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -449,7 +449,7 @@ ok($mic->logout, 'logged out');
 }
 
 SKIP: {
 }
 
 SKIP: {
-       use_ok 'PublicInbox::WatchMaildir';
+       use_ok 'PublicInbox::Watch';
        use_ok 'PublicInbox::InboxIdle';
        require_git('1.8.5', 1) or
                skip('git 1.8.5+ needed for --urlmatch', 4);
        use_ok 'PublicInbox::InboxIdle';
        require_git('1.8.5', 1) or
                skip('git 1.8.5+ needed for --urlmatch', 4);
index 74e21a4193738e439c1e04d5bb4567678458a322..d8a44334a55bf13e0b0037a3b3c8ba3e90085df9 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -396,7 +396,7 @@ sub read_til_dot {
 
 sub test_watch {
        my ($tmpdir, $sock, $group) = @_;
 
 sub test_watch {
        my ($tmpdir, $sock, $group) = @_;
-       use_ok 'PublicInbox::WatchMaildir';
+       use_ok 'PublicInbox::Watch';
        use_ok 'PublicInbox::InboxIdle';
        use_ok 'PublicInbox::Config';
        require_git('1.8.5', 1) or skip('git 1.8.5+ needed for --urlmatch', 4);
        use_ok 'PublicInbox::InboxIdle';
        use_ok 'PublicInbox::Config';
        require_git('1.8.5', 1) or skip('git 1.8.5+ needed for --urlmatch', 4);
index db48cb2ffde3d60742ed208a305a8cda702a57f0..4b72dbae97f763c2a88df4a4220266c636fe74c1 100644 (file)
@@ -7,7 +7,7 @@ use Test::More;
 use PublicInbox::Eml;
 use PublicInbox::Config;
 require_mods(qw(DBD::SQLite Search::Xapian));
 use PublicInbox::Eml;
 use PublicInbox::Config;
 require_mods(qw(DBD::SQLite Search::Xapian));
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{PI_CONFIG} = "$tmpdir/pi_config";
 use_ok 'PublicInbox::Emergency';
 my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{PI_CONFIG} = "$tmpdir/pi_config";
@@ -76,7 +76,7 @@ EOF
        my $ibx = $config->lookup_name($v);
        ok($ibx, 'found inbox by name');
 
        my $ibx = $config->lookup_name($v);
        ok($ibx, 'found inbox by name');
 
-       my $w = PublicInbox::WatchMaildir->new($config);
+       my $w = PublicInbox::Watch->new($config);
        for my $i (1..2) {
                $w->scan('full');
        }
        for my $i (1..2) {
                $w->scan('full');
        }
index 9433bb6f443ffc906fe4d5c221ad2612eb1f0c3b..fb71d3dfe57b30c3c9e56e1a3b6784cc65fe08f0 100644 (file)
@@ -5,14 +5,14 @@ use Test::More;
 use PublicInbox::Config;
 # see t/imapd*.t for tests against a live IMAP server
 
 use PublicInbox::Config;
 # see t/imapd*.t for tests against a live IMAP server
 
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 my $cfg = PublicInbox::Config->new(\<<EOF);
 publicinbox.i.address=i\@example.com
 publicinbox.i.inboxdir=/nonexistent
 publicinbox.i.watch=imap://example.com/INBOX.a
 publicinboxlearn.watchspam=imap://example.com/INBOX.spam
 EOF
 my $cfg = PublicInbox::Config->new(\<<EOF);
 publicinbox.i.address=i\@example.com
 publicinbox.i.inboxdir=/nonexistent
 publicinbox.i.watch=imap://example.com/INBOX.a
 publicinboxlearn.watchspam=imap://example.com/INBOX.spam
 EOF
-my $watch = PublicInbox::WatchMaildir->new($cfg);
+my $watch = PublicInbox::Watch->new($cfg);
 is($watch->{imap}->{'imap://example.com/INBOX.a'}->[0]->{name}, 'i',
        'watched an inbox');
 is($watch->{imap}->{'imap://example.com/INBOX.spam'}, 'watchspam',
 is($watch->{imap}->{'imap://example.com/INBOX.a'}->[0]->{name}, 'i',
        'watched an inbox');
 is($watch->{imap}->{'imap://example.com/INBOX.spam'}, 'watchspam',
index c44273f051902afe94694832ca4f6a5f3652c3bc..ae53caf92f11ca26f4fd7baa3ed9f29fa07186f0 100644 (file)
@@ -11,7 +11,7 @@ my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/test.git";
 my $maildir = "$tmpdir/md";
 my $spamdir = "$tmpdir/spam";
 my $git_dir = "$tmpdir/test.git";
 my $maildir = "$tmpdir/md";
 my $spamdir = "$tmpdir/spam";
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
@@ -40,7 +40,7 @@ $cfgpfx.inboxdir=$git_dir
 $cfgpfx.watch=maildir:$spamdir
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
 $cfgpfx.watch=maildir:$spamdir
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-       my $wm = PublicInbox::WatchMaildir->new($config);
+       my $wm = PublicInbox::Watch->new($config);
        is(scalar grep(/is a spam folder/, @w), 1, 'got warning about spam');
        is_deeply($wm->{mdmap}, { "$spamdir/cur" => 'watchspam' },
                'only got the spam folder to watch');
        is(scalar grep(/is a spam folder/, @w), 1, 'got warning about spam');
        is_deeply($wm->{mdmap}, { "$spamdir/cur" => 'watchspam' },
                'only got the spam folder to watch');
@@ -62,7 +62,7 @@ EOF
 }
 
 my $config = PublicInbox::Config->new($cfg_path);
 }
 
 my $config = PublicInbox::Config->new($cfg_path);
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 my $git = PublicInbox::Git->new($git_dir);
 my @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 1, 'one revision in rev-list');
 my $git = PublicInbox::Git->new($git_dir);
 my @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 1, 'one revision in rev-list');
@@ -79,7 +79,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 2, 'two revisions in rev-list');
 @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
 @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 2, 'two revisions in rev-list');
 @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
@@ -93,7 +93,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 1, 'tree has one file');
        my $mref = $git->cat_file('HEAD:'.$list[0]);
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 1, 'tree has one file');
        my $mref = $git->cat_file('HEAD:'.$list[0]);
@@ -101,7 +101,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
        is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
        $write_spam->();
 
        is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
        $write_spam->();
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 0, 'tree is empty');
        @list = $git->qx(qw(rev-list refs/heads/master));
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 0, 'tree is empty');
        @list = $git->qx(qw(rev-list refs/heads/master));
@@ -118,7 +118,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        {
                local $SIG{__WARN__} = sub {}; # quiet spam check warning
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        {
                local $SIG{__WARN__} = sub {}; # quiet spam check warning
-               PublicInbox::WatchMaildir->new($config)->scan('full');
+               PublicInbox::Watch->new($config)->scan('full');
        }
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 0, 'tree has no files spamc checked');
        }
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 0, 'tree has no files spamc checked');
@@ -133,7 +133,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 1, 'tree has one file after spamc checked');
 
        @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
        is(scalar @list, 1, 'tree has one file after spamc checked');
 
@@ -211,7 +211,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
 sub is_maildir {
        my ($dir) = @_;
 
 sub is_maildir {
        my ($dir) = @_;
-       PublicInbox::WatchMaildir::is_maildir($dir);
+       PublicInbox::Watch::is_maildir($dir);
 }
 
 is(is_maildir('maildir:/hello//world'), '/hello/world', 'extra slash gone');
 }
 
 is(is_maildir('maildir:/hello//world'), '/hello/world', 'extra slash gone');
index 59ec247ecfda337f8c0412231fcafdcf2583b5d5..ca1cf9656889934c8b60b7dcb406376d7189185f 100644 (file)
@@ -14,7 +14,7 @@ my ($tmpdir, $for_destroy) = tmpdir();
 my $inboxdir = "$tmpdir/v2";
 my $maildir = "$tmpdir/md";
 my $spamdir = "$tmpdir/spam";
 my $inboxdir = "$tmpdir/v2";
 my $maildir = "$tmpdir/md";
 my $spamdir = "$tmpdir/spam";
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
@@ -49,7 +49,7 @@ my $ibx = $config->lookup_name('test');
 ok($ibx, 'found inbox by name');
 my $srch = $ibx->search;
 
 ok($ibx, 'found inbox by name');
 my $srch = $ibx->search;
 
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 my $total = scalar @{$srch->reopen->query('')};
 is($total, 1, 'got one revision');
 
 my $total = scalar @{$srch->reopen->query('')};
 is($total, 1, 'got one revision');
 
@@ -69,7 +69,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 is_deeply($srch->reopen->query(''), [], 'deleted file');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
 is_deeply($srch->reopen->query(''), [], 'deleted file');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
@@ -80,7 +80,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        my $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 1, 'got one file back');
        my $mref = $ibx->msg_by_smsg($msgs->[0]);
        my $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 1, 'got one file back');
        my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -88,7 +88,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
        is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
        $write_spam->();
 
        is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
        $write_spam->();
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 0, 'inbox is empty again');
        is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
        $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 0, 'inbox is empty again');
        is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
@@ -103,7 +103,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        {
                local $SIG{__WARN__} = sub {}; # quiet spam check warning
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        {
                local $SIG{__WARN__} = sub {}; # quiet spam check warning
-               PublicInbox::WatchMaildir->new($config)->scan('full');
+               PublicInbox::Watch->new($config)->scan('full');
        }
        my $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 0, 'inbox is still empty');
        }
        my $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 0, 'inbox is still empty');
@@ -117,7 +117,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        local $ENV{PATH} = $main_path;
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
        local $ENV{PATH} = $main_path;
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        my $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 1, 'inbox has one mail after spamc OK-ed a message');
        my $mref = $ibx->msg_by_smsg($msgs->[0]);
        my $msgs = $srch->reopen->query('');
        is(scalar(@$msgs), 1, 'inbox has one mail after spamc OK-ed a message');
        my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -130,7 +130,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
        open my $fh, '<', $patch or die "failed to open $patch: $!\n";
        $msg = do { local $/; <$fh> };
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
        open my $fh, '<', $patch or die "failed to open $patch: $!\n";
        $msg = do { local $/; <$fh> };
        PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        my $msgs = $srch->reopen->query('dfpost:6e006fd7');
        is(scalar(@$msgs), 1, 'diff postimage found');
        my $post = $msgs->[0];
        my $msgs = $srch->reopen->query('dfpost:6e006fd7');
        is(scalar(@$msgs), 1, 'diff postimage found');
        my $post = $msgs->[0];
@@ -161,7 +161,7 @@ Date: Sat, 18 Jun 2016 00:00:00 +0000
 both
 EOF
        PublicInbox::Emergency->new($maildir)->prepare(\$both);
 both
 EOF
        PublicInbox::Emergency->new($maildir)->prepare(\$both);
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->new($config)->scan('full');
        my $msgs = $srch->reopen->query('m:both@b.com');
        my $v1 = $config->lookup_name('v1');
        my $msg = $v1->git->cat_file($msgs->[0]->{blob});
        my $msgs = $srch->reopen->query('m:both@b.com');
        my $v1 = $config->lookup_name('v1');
        my $msg = $v1->git->cat_file($msgs->[0]->{blob});
@@ -186,7 +186,7 @@ EOF
        PublicInbox::Emergency->new($maildir)->prepare(\$want);
        PublicInbox::Emergency->new($maildir)->prepare(\$do_not_want);
        my $config = PublicInbox::Config->new(\$cfg);
        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');
+       PublicInbox::Watch->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');
        $ibx = $config->lookup_name('test');
        my $num = $ibx->mm->num_for('do.want@example.com');
        ok(defined $num, 'List-ID matched for watch');
@@ -195,7 +195,7 @@ EOF
 
        $cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
        $config = PublicInbox::Config->new(\$cfg);
 
        $cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
        $config = PublicInbox::Config->new(\$cfg);
-       PublicInbox::WatchMaildir->new($config)->scan('full');
+       PublicInbox::Watch->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');
        $ibx = $config->lookup_name('test');
        $num = $ibx->mm->num_for('do.not.want@example.com');
        ok(defined $num, 'X-Mailing-List matched');
index 0ee96d5ff89d2eb31d88adb27d1cadaa95481b0b..a081353210275b4d38b5256f92c2dda3c85ea285 100644 (file)
@@ -9,7 +9,7 @@ require_mods(qw(Search::Xapian DBD::SQLite));
 my ($tmpdir, $for_destroy) = tmpdir();
 my $inboxdir = "$tmpdir/v2";
 my $maildir = "$tmpdir/md";
 my ($tmpdir, $for_destroy) = tmpdir();
 my $inboxdir = "$tmpdir/v2";
 my $maildir = "$tmpdir/md";
-use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Watch';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
 use_ok 'PublicInbox::Emergency';
 my $cfgpfx = "publicinbox.test";
 my $addr = 'test-public@example.com';
@@ -62,7 +62,7 @@ $cfgpfx.watchheader=To:$addr
 $cfgpfx.watchheader=Cc:$addr
 EOF
 my $config = PublicInbox::Config->new(\$cfg);
 $cfgpfx.watchheader=Cc:$addr
 EOF
 my $config = PublicInbox::Config->new(\$cfg);
-PublicInbox::WatchMaildir->new($config)->scan('full');
+PublicInbox::Watch->new($config)->scan('full');
 my $ibx = $config->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
 my $ibx = $config->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
index 98fb1161d1c40ddde682757258d7a279cc4054f2..ce1a3153e205eaf5b5fb07a57d413f49234f3abc 100644 (file)
@@ -5,8 +5,8 @@ use Test::More;
 use PublicInbox::Config;
 # see t/nntpd*.t for tests against a live NNTP server
 
 use PublicInbox::Config;
 # see t/nntpd*.t for tests against a live NNTP server
 
-use_ok 'PublicInbox::WatchMaildir';
-my $nntp_url = \&PublicInbox::WatchMaildir::nntp_url;
+use_ok 'PublicInbox::Watch';
+my $nntp_url = \&PublicInbox::Watch::nntp_url;
 is('news://example.com/inbox.foo',
        $nntp_url->('NEWS://examplE.com/inbox.foo'), 'lowercased');
 is('nntps://example.com/inbox.foo',
 is('news://example.com/inbox.foo',
        $nntp_url->('NEWS://examplE.com/inbox.foo'), 'lowercased');
 is('nntps://example.com/inbox.foo',