about summary refs log tree commit homepage
path: root/lib/PublicInbox/InboxWritable.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-06-09 07:47:47 +0000
committerEric Wong <e@80x24.org>2021-06-09 10:03:42 +0000
commit7a7034a3264ac99523e661c41fc9ba320a4b3766 (patch)
tree2ab21b11acfb3a3aa45ad66057be99d93e6256bb /lib/PublicInbox/InboxWritable.pm
parentcd2b547780a0f66115710865543accf5282c59d3 (diff)
downloadpublic-inbox-7a7034a3264ac99523e661c41fc9ba320a4b3766.tar.gz
I'm not sure if anybody uses this, but it exists.  It'll likely
be dropped in the future.

Fixes: fa3f0cbcd1af5008 ("use MdirReader in -watch and InboxWritable")
Diffstat (limited to 'lib/PublicInbox/InboxWritable.pm')
-rw-r--r--lib/PublicInbox/InboxWritable.pm15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm
index 45d8cdc7..65539781 100644
--- a/lib/PublicInbox/InboxWritable.pm
+++ b/lib/PublicInbox/InboxWritable.pm
@@ -131,13 +131,9 @@ sub eml_from_path ($) {
         }
 }
 
-sub _each_maildir_fn {
-        my ($fn, $im, $self) = @_;
-        if ($fn =~ /:2,([A-Za-z]*)\z/) {
-                my $fl = $1;
-                return if $fl =~ /[DT]/; # no Drafts or Trash for public
-        }
-        my $eml = eml_from_path($fn) or return;
+sub _each_maildir_eml {
+        my ($fn, $kw, $eml, $im, $self) = @_;
+        return if grep(/\Adraft\z/, @$kw);
         if ($self && (my $filter = $self->filter($im))) {
                 my $ret = $filter->scrub($eml) or return;
                 return if $ret == REJECT();
@@ -146,6 +142,7 @@ sub _each_maildir_fn {
         $im->add($eml);
 }
 
+# XXX does anybody use this?
 sub import_maildir {
         my ($self, $dir) = @_;
         foreach my $sub (qw(cur new tmp)) {
@@ -154,8 +151,8 @@ sub import_maildir {
         my $im = $self->importer(1);
         my @self = $self->filter($im) ? ($self) : ();
         require PublicInbox::MdirReader;
-        PublicInbox::MdirReader->new->maildir_each_file(\&_each_maildir_fn,
-                                                        $im, @self);
+        PublicInbox::MdirReader->new->maildir_each_eml($dir,
+                                        \&_each_maildir_eml, $im, @self);
         $im->done;
 }