diff options
author | Eric Wong <e@80x24.org> | 2014-03-31 20:16:19 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2014-04-05 06:55:35 +0000 |
commit | b949afc9edf89dd494cac6255c78b124d58e11a5 (patch) | |
tree | 0f913be48d2ddbd98449714cb4bac3e0a69e2803 /lib | |
parent | 23c5bbce9529577c3a70b8ee26aa98310d5bc3b0 (diff) | |
download | public-inbox-b949afc9edf89dd494cac6255c78b124d58e11a5.tar.gz |
We will also be using the RECIPIENT env in the future, since that takes aliases into account. Reducing the possible callsites to check ENV means we can more easily update the code in the future.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox.pm | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/PublicInbox.pm b/lib/PublicInbox.pm index 56137d14..a4aba346 100644 --- a/lib/PublicInbox.pm +++ b/lib/PublicInbox.pm @@ -13,22 +13,21 @@ sub __drop_plus { $str_addr; } -# do not allow Bcc, only Cc and To if ORIGINAL_RECIPIENT (postfix) env is set +# do not allow Bcc, only Cc and To if recipient is set sub precheck { - my ($klass, $filter) = @_; + my ($klass, $filter, $recipient) = @_; my $simple = $filter->simple; return 0 unless $simple->header("Message-ID"); return 0 unless defined($filter->from); return 0 if length($simple->as_string) > MAX_SIZE; - recipient_specified($filter); + recipient_specified($filter, $recipient); } sub recipient_specified { - my ($filter) = @_; - my $or = $ENV{ORIGINAL_RECIPIENT}; - defined($or) or return 1; # for imports - my @or = Email::Address->parse($or); - my $oaddr = __drop_plus($or[0]->address); + my ($filter, $recipient) = @_; + defined($recipient) or return 1; # for mass imports + my @recip = Email::Address->parse($recipient); + my $oaddr = __drop_plus($recip[0]->address); $oaddr = qr/\b\Q$oaddr\E\b/i; my @to = Email::Address->parse($filter->to); my @cc = Email::Address->parse($filter->cc); |