]> Sergey Matveev's repositories - public-inbox.git/commitdiff
use ORIGINAL_RECIPIENT once again
authorEric Wong <e@80x24.org>
Sun, 20 Apr 2014 23:27:46 +0000 (23:27 +0000)
committerEric Wong <e@80x24.org>
Sun, 20 Apr 2014 23:27:46 +0000 (23:27 +0000)
It should be common for a single users to be subscribed to multiple
addresses/lists, so we must use the address before alias expansion.

This partially reverts commit b949afc9edf89dd494cac6255c78b124d58e11a5

Documentation/public-inbox-mda.txt
public-inbox-mda
scripts/import_gmane_spool
t/cgi.t
t/mda.t
t/precheck.t

index 2957093904af88ddd44ab9332fe1691d7f4b0d94..8e33e02f6602a7fbe218fff42b3fb80ba8d9b7ed 100644 (file)
@@ -11,7 +11,7 @@ Each system user may have their own public-inbox instances
 
 # ENVIRONMENT
 
-* RECIPIENT - the recipient email address, from Postfix
+* ORIGINAL_RECIPIENT - the original recipient email address, from Postfix
 * PI_CONFIG - config file. default: ~/.public-inbox/config
 * PI_EMERGENCY - emergency destination.  default: ~/.public-inbox/emergency/
 
index 504fefd7ee1a042351ea2adb98edaad35f51dc2a..6c446749c28cee37e6e8b8482a8a8c6c2c2d0fe5 100755 (executable)
@@ -25,8 +25,8 @@ $emergency = expand_filename($emergency);
 my $filter = Email::Filter->new(emergency => $emergency);
 my $config = PublicInbox::Config->new;
 
-my $recipient = $ENV{RECIPIENT};
-defined $recipient or die "RECIPIENT not defined in ENV\n";
+my $recipient = $ENV{ORIGINAL_RECIPIENT};
+defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n";
 my $dst = $config->lookup($recipient);
 defined $dst or exit(1);
 my $main_repo = $dst->{mainrepo} or exit(1);
index e072b810d5c1275c2f3acec6fef0e10942ec4e76..3cda0bf6d7dc8d2c5517347d103849627467012b 100755 (executable)
@@ -6,10 +6,10 @@
 =begin usage
        mkdir -p $HOME/.public-inbox
        MAINREPO=/path/to/your/repo.git
-       export RECIPIENT='list@example.com'
+       export ORIGINAL_RECIPIENT='list@example.com'
        git init --bare $MAINREPO
        export GIT_CONFIG=$HOME/.public-inbox/config
-       git config publicinbox.$LISTNAME.address $RECIPIENT
+       git config publicinbox.$LISTNAME.address $ORIGINAL_RECIPIENT
        git config publicinbox.$LISTNAME.mainrepo $MAINREPO
        unset GIT_CONFIG
        ./import_gmane_spool SLRNPULL_ROOT/news/foo/bar
@@ -22,7 +22,7 @@ use PublicInbox::Config;
 use IPC::Run qw(run);
 sub usage { "Usage:\n".join("",grep(/\t/, `head -n 24 $0`)) }
 my $spool = shift @ARGV or die usage();
-defined $ENV{RECIPIENT} or die usage();
+defined $ENV{ORIGINAL_RECIPIENT} or die usage();
 my @args = ('public-inbox-mda');
 
 chdir $spool or die "chdir $spool failed: $!\n";
diff --git a/t/cgi.t b/t/cgi.t
index b992af311e4fefedd098ffbb5c2af10bda7a226e..f7035228e29534a70ebda7faeedbd99e82b2c6a0 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -43,7 +43,7 @@ my $failbox = "$home/fail.mbox";
 local $ENV{PI_EMERGENCY} = $failbox;
 {
        local $ENV{HOME} = $home;
-       local $ENV{RECIPIENT} = $addr;
+       local $ENV{ORIGINAL_RECIPIENT} = $addr;
 
        # ensure successful message delivery
        {
@@ -145,7 +145,7 @@ EOF
 
        {
                local $ENV{HOME} = $home;
-               local $ENV{RECIPIENT} = $addr;
+               local $ENV{ORIGINAL_RECIPIENT} = $addr;
                run_with_env({PATH => $main_path}, [$mda], \$in);
        }
        local $ENV{GIT_DIR} = $maindir;
diff --git a/t/mda.t b/t/mda.t
index d70288bc785d419039cb0f367f65e071e4e247b1..3357718cd08b67c92f734f22fbd117b3decf944f 100644 (file)
--- a/t/mda.t
+++ b/t/mda.t
@@ -47,7 +47,7 @@ my $failbox = "$home/fail.mbox";
        my $good_rev;
        local $ENV{PI_EMERGENCY} = $failbox;
        local $ENV{HOME} = $home;
-       local $ENV{RECIPIENT} = $addr;
+       local $ENV{ORIGINAL_RECIPIENT} = $addr;
        my $simple = Email::Simple->new(<<EOF);
 From: Me <me\@example.com>
 To: You <you\@example.com>
@@ -135,7 +135,7 @@ Date: deadbeef
 {
        local $ENV{PI_EMERGENCY} = $failbox;
        local $ENV{HOME} = $home;
-       local $ENV{RECIPIENT} = $addr;
+       local $ENV{ORIGINAL_RECIPIENT} = $addr;
        local $ENV{PATH} = $main_path;
        my $mid = 'spam-train@example.com';
        my $simple = Email::Simple->new(<<EOF);
@@ -169,7 +169,7 @@ EOF
 {
        local $ENV{PI_EMERGENCY} = $failbox;
        local $ENV{HOME} = $home;
-       local $ENV{RECIPIENT} = $addr;
+       local $ENV{ORIGINAL_RECIPIENT} = $addr;
        local $ENV{PATH} = $main_path;
        my $mid = 'ham-train@example.com';
        my $simple = Email::Simple->new(<<EOF);
@@ -199,7 +199,7 @@ EOF
        my $faildir= "$home/faildir/";
        local $ENV{PI_EMERGENCY} = $faildir;
        local $ENV{HOME} = $home;
-       local $ENV{RECIPIENT} = $addr;
+       local $ENV{ORIGINAL_RECIPIENT} = $addr;
        local $ENV{PATH} = $fail_path;
        my $in = <<EOF;
 From: Faildir <faildir\@example.com>
index 42592bc271fc0448e0ab49d764b544913efa83c2..974d6a3879d2d0440a56f193f588004b41beca5a 100644 (file)
@@ -13,19 +13,19 @@ sub do_checks {
        my $f = Email::Filter->new(data => $s->as_string);
 
        ok(PublicInbox::MDA->precheck($f, undef),
-               "RECIPIENT unset is OK");
+               "ORIGINAL_RECIPIENT unset is OK");
 
        my $recipient = 'foo@example.com';
        ok(!PublicInbox::MDA->precheck($f, $recipient),
-               "wrong RECIPIENT rejected");
+               "wrong ORIGINAL_RECIPIENT rejected");
 
        $recipient = 'b@example.com';
        ok(PublicInbox::MDA->precheck($f, $recipient),
-               "RECIPIENT in To: is OK");
+               "ORIGINAL_RECIPIENT in To: is OK");
 
        $recipient = 'c@example.com';
        ok(PublicInbox::MDA->precheck($f, $recipient),
-               "RECIPIENT in Cc: is OK");
+               "ORIGINAL_RECIPIENT in Cc: is OK");
 }
 
 {