diff options
author | Eric Wong <e@yhbt.net> | 2020-08-01 08:12:25 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-08-02 08:26:18 +0000 |
commit | 84e006fdb9fb72010d6a0dac15287ff43bd1772c (patch) | |
tree | 2940dcff9f1f75775654a5178e44a626c44fd3c6 /lib/PublicInbox | |
parent | 9447bac572fccad88f8a1aacf0cd3aceef787182 (diff) | |
download | public-inbox-84e006fdb9fb72010d6a0dac15287ff43bd1772c.tar.gz |
This is more accurate given we use PublicInbox::Eml instead of Email::MIME/PublicInbox::MIME, nowadays.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/InboxWritable.pm | 9 | ||||
-rw-r--r-- | lib/PublicInbox/WatchMaildir.pm | 7 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm index e8ecd3fb..7fb5a150 100644 --- a/lib/PublicInbox/InboxWritable.pm +++ b/lib/PublicInbox/InboxWritable.pm @@ -4,11 +4,12 @@ # Extends read-only Inbox for writing package PublicInbox::InboxWritable; use strict; -use warnings; -use base qw(PublicInbox::Inbox); +use v5.10.1; +use parent qw(PublicInbox::Inbox Exporter); use PublicInbox::Import; use PublicInbox::Filter::Base qw(REJECT); use Errno qw(ENOENT); +our @EXPORT_OK = qw(eml_from_path); use constant { PERM_UMASK => 0, @@ -133,7 +134,7 @@ sub is_maildir_path ($) { (is_maildir_basename($p[-1]) && -f $path) ? 1 : 0; } -sub mime_from_path ($) { +sub eml_from_path ($) { my ($path) = @_; if (open my $fh, '<', $path) { my $str = do { local $/; <$fh> } or return; @@ -155,7 +156,7 @@ sub import_maildir { opendir my $dh, "$dir/$sub" or die "opendir $dir/$sub: $!\n"; while (defined(my $fn = readdir($dh))) { next unless is_maildir_basename($fn); - my $mime = mime_from_path("$dir/$fn") or next; + my $mime = eml_from_path("$dir/$fn") or next; if (my $filter = $self->filter($im)) { my $ret = $filter->scrub($mime) or return; diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index fad708d8..814b455b 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -7,7 +7,7 @@ package PublicInbox::WatchMaildir; use strict; use warnings; use PublicInbox::Eml; -use PublicInbox::InboxWritable; +use PublicInbox::InboxWritable qw(eml_from_path); use PublicInbox::Filter::Base qw(REJECT); use PublicInbox::Spamcheck; use PublicInbox::Sigfd; @@ -15,7 +15,6 @@ use PublicInbox::DS qw(now); use PublicInbox::MID qw(mids); use PublicInbox::ContentHash qw(content_hash); use POSIX qw(_exit); -*mime_from_path = \&PublicInbox::InboxWritable::mime_from_path; sub compile_watchheaders ($) { my ($ibx) = @_; @@ -154,7 +153,7 @@ sub _remove_spam { my ($self, $path) = @_; # path must be marked as (S)een $path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return; - my $eml = mime_from_path($path) or return; + my $eml = eml_from_path($path) or return; $self->{config}->each_inbox(\&remove_eml_i, [ $self, $eml, $path ]); } @@ -207,7 +206,7 @@ sub _try_path { return _remove_spam($self, $path); } foreach my $ibx (@$inboxes) { - my $eml = mime_from_path($path) or next; + my $eml = eml_from_path($path) or next; import_eml($self, $ibx, $eml); } } |