We will be combining common code between -learn and -mda
Makefile.PL
README
examples/public-inbox-config
Makefile.PL
README
examples/public-inbox-config
lib/PublicInbox/Config.pm
lib/PublicInbox/Feed.pm
lib/PublicInbox/Filter.pm
lib/PublicInbox/Config.pm
lib/PublicInbox/Feed.pm
lib/PublicInbox/Filter.pm
# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+package PublicInbox::MDA;
use strict;
use warnings;
use Email::Address;
use strict;
use warnings;
use Email::Address;
use File::Path::Expand qw/expand_filename/;
use IPC::Run qw(run);
use constant MDA => 'ssoma-mda';
use File::Path::Expand qw/expand_filename/;
use IPC::Run qw(run);
use constant MDA => 'ssoma-mda';
use PublicInbox::Filter;
use PublicInbox::Config;
use PublicInbox::Filter;
use PublicInbox::Config;
my $main_repo = $dst->{mainrepo} or exit(1);
my $filtered; # string dest
my $main_repo = $dst->{mainrepo} or exit(1);
my $filtered; # string dest
-if (PublicInbox->precheck($filter, $recipient) &&
+if (PublicInbox::MDA->precheck($filter, $recipient) &&
do_spamc($filter->simple, \$filtered)) {
# update our message with SA headers (in case our filter rejects it)
my $simple = Email::Simple->new($filtered);
do_spamc($filter->simple, \$filtered)) {
# update our message with SA headers (in case our filter rejects it)
my $simple = Email::Simple->new($filtered);
use Test::More;
use Email::Simple;
use Email::Filter;
use Test::More;
use Email::Simple;
use Email::Filter;
sub do_checks {
my ($s) = @_;
my $f = Email::Filter->new(data => $s->as_string);
sub do_checks {
my ($s) = @_;
my $f = Email::Filter->new(data => $s->as_string);
- ok(PublicInbox->precheck($f, undef),
+ ok(PublicInbox::MDA->precheck($f, undef),
"RECIPIENT unset is OK");
my $recipient = 'foo@example.com';
"RECIPIENT unset is OK");
my $recipient = 'foo@example.com';
- ok(!PublicInbox->precheck($f, $recipient),
+ ok(!PublicInbox::MDA->precheck($f, $recipient),
"wrong RECIPIENT rejected");
$recipient = 'b@example.com';
"wrong RECIPIENT rejected");
$recipient = 'b@example.com';
- ok(PublicInbox->precheck($f, $recipient),
+ ok(PublicInbox::MDA->precheck($f, $recipient),
"RECIPIENT in To: is OK");
$recipient = 'c@example.com';
"RECIPIENT in To: is OK");
$recipient = 'c@example.com';
- ok(PublicInbox->precheck($f, $recipient),
+ ok(PublicInbox::MDA->precheck($f, $recipient),
"RECIPIENT in Cc: is OK");
}
"RECIPIENT in Cc: is OK");
}
body => "hello world\n",
);
my $f = Email::Filter->new(data => $s->as_string);
body => "hello world\n",
);
my $f = Email::Filter->new(data => $s->as_string);
- ok(!PublicInbox->precheck($f, $recipient), "missing From: is rejected");
+ ok(!PublicInbox::MDA->precheck($f, $recipient),
+ "missing From: is rejected");