use Email::Filter;
use Email::MIME;
-use Email::Address;
-use File::Path::Expand qw/expand_filename/;
+use Email::MIME::ContentType;
+$Email::MIME::ContentType::STRICT_PARAMS = 0; # user input is imperfect
use IPC::Run qw(run);
use PublicInbox::MDA;
use PublicInbox::Filter;
# n.b: hopefully we can setup the emergency path without bailing due to
# user error, we really want to setup the emergency destination ASAP
# in case there's bugs in our code or user error.
-my $emergency = $ENV{PI_EMERGENCY} || '~/.public-inbox/emergency/';
-$emergency = expand_filename($emergency);
+my $emergency = $ENV{PI_EMERGENCY} || "$ENV{HOME}/.public-inbox/emergency/";
# this reads the message from stdin
my $filter = Email::Filter->new(emergency => $emergency);
my $main_repo = $dst->{mainrepo} or exit(1);
my $filtered; # string dest
-if (PublicInbox::MDA->precheck($filter, $dst->{address}) &&
+if (PublicInbox::MDA->precheck($filter->simple, $dst->{address}) &&
do_spamc($filter->simple, \$filtered)) {
# update our message with SA headers (in case our filter rejects it)
my $msg = Email::MIME->new(\$filtered);
} elsif ($fcfg eq 'scrub') {
$filter_arg = undef; # the default for legacy versions
} else {
- warn "publicinbox.$dst->{listname}.filter=$fcfg invalid\n";
+ warn "publicinbox.$dst->{name}.filter=$fcfg invalid\n";
warn "must be either 'scrub' or 'reject' (the default)\n";
}
};
my $git = PublicInbox::Git->new($main_repo);
my $im = PublicInbox::Import->new($git,
- $dst->{listname}, $recipient);
+ $dst->{name}, $recipient);
if (defined $im->add($msg)) {
$im->done;
$filter->ignore; # exits
sub index_sync {
my ($git_dir) = @_;
-
- # potentially user-visible, ignore errors:
- system('git', "--git-dir=$git_dir", 'update-server-info');
-
eval {
require PublicInbox::SearchIdx;
PublicInbox::SearchIdx->new($git_dir, 2)->index_sync;