From 41aa4756879765d0c6d4d6e8754e0037b1a56fcc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 15 Jun 2016 00:14:26 +0000 Subject: mda: precheck no longer depends on Email::Filter Email::Filter doesn't offer any functionality we need, here; and our dependency on Email::Filter will gradually be removed since it (and Email::LocalDelivery) seem abandoned and we can have more-fine-grained control by rolling our own Maildir delivery which can work transactionally. --- lib/PublicInbox/MDA.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm index 2e6e9ec5..0f583e65 100644 --- a/lib/PublicInbox/MDA.pm +++ b/lib/PublicInbox/MDA.pm @@ -32,18 +32,17 @@ sub __drop_plus { # do not allow Bcc, only Cc and To if recipient is set sub precheck { - my ($klass, $filter, $address) = @_; - my Email::Simple $simple = $filter->simple; + my ($klass, $simple, $address) = @_; my @mid = $simple->header('Message-ID'); return 0 if scalar(@mid) != 1; my $mid = $mid[0]; return 0 if (length($mid) > MAX_MID_SIZE); return 0 unless usable_str(length(''), $mid) && $mid =~ /\@/; - return 0 unless usable_str(length('u@h'), $filter->from); + return 0 unless usable_str(length('u@h'), $simple->header("From")); return 0 unless usable_str(length(':o'), $simple->header("Subject")); return 0 unless usable_date($simple->header("Date")); return 0 if length($simple->as_string) > MAX_SIZE; - alias_specified($filter, $address); + alias_specified($simple, $address); } sub usable_str { @@ -57,14 +56,14 @@ sub usable_date { } sub alias_specified { - my ($filter, $address) = @_; + my ($simple, $address) = @_; my @address = ref($address) eq 'ARRAY' ? @$address : ($address); my %ok = map { lc(__drop_plus($_)) => 1; } @address; - foreach my $line ($filter->cc, $filter->to) { + foreach my $line ($simple->header('Cc'), $simple->header('To')) { my @addrs = ($line =~ /([^<\s]+\@[^>\s]+)/g); foreach my $addr (@addrs) { if ($ok{lc(__drop_plus($addr))}) { -- cgit v1.2.3-24-ge0c7