]> Sergey Matveev's repositories - public-inbox.git/blobdiff - public-inbox-mda
move precheck to MDA namespace
[public-inbox.git] / public-inbox-mda
index 2335cd3e068437321f58cfd83b396a8d8fa266ad..dd3dac80291c14a962c92673b2da7c92cec2498a 100755 (executable)
@@ -12,18 +12,18 @@ use Encode::MIME::Header;
 use File::Path::Expand qw/expand_filename/;
 use IPC::Run qw(run);
 use constant MDA => 'ssoma-mda';
-use PublicInbox;
+use PublicInbox::MDA;
 use PublicInbox::Filter;
 use PublicInbox::Config;
 
-# n.b: hopefully we can setup the failbox path without bailing due to
+# 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 $failbox = $ENV{PI_FAILBOX} || '~/public-inbox-fail.mbox';
-$failbox = expand_filename($failbox);
+my $emergency = $ENV{PI_EMERGENCY} || '~/.public-inbox/emergency/';
+$emergency = expand_filename($emergency);
 
 # this reads the message from stdin
-my $filter = Email::Filter->new(emergency => $failbox);
+my $filter = Email::Filter->new(emergency => $emergency);
 my $config = PublicInbox::Config->new;
 
 my $recipient = $ENV{RECIPIENT};
@@ -33,7 +33,7 @@ defined $dst or exit(1);
 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);
@@ -64,7 +64,7 @@ if (PublicInbox->precheck($filter, $recipient) &&
                }
        }
 }
-exit 0; # goes to failbox
+exit 0; # goes to emergency
 
 # we depend on "report_safe 0" in /etc/spamassassin/*.cf with --headers
 # not using Email::Filter->pipe here since we want the stdout of