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::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';
my $total = scalar @{$srch->reopen->query('')};
is($total, 1, 'got one revision');
my $total = scalar @{$srch->reopen->query('')};
is($total, 1, 'got one revision');
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');
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);
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]);
$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');
$config->{'publicinboxwatch.spamcheck'} = 'spamc';
{
local $SIG{__WARN__} = sub {}; # quiet spam check warning
$config->{'publicinboxwatch.spamcheck'} = 'spamc';
{
local $SIG{__WARN__} = sub {}; # quiet spam check warning
}
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');
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';
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]);
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);
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];
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});
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);
$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');
$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);
$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');