about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiToMail.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-08 05:06:51 -0100
committerEric Wong <e@80x24.org>2021-02-08 08:30:24 +0000
commit8600c999da4786d2297ebbf44aa0618461c2f3cf (patch)
tree0973a5cc36bf92195162ccee8282c39dbc975b4a /lib/PublicInbox/LeiToMail.pm
parent072d326a8acb2633fbbadf87005b7e546e3da832 (diff)
downloadpublic-inbox-8600c999da4786d2297ebbf44aa0618461c2f3cf.tar.gz
It seems to be working trivially, though I'm probably
going to split out Maildir reading into a separate
package rather than using LeiToMail.
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r--lib/PublicInbox/LeiToMail.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index 3f65e9e9..4c5a5685 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -266,8 +266,9 @@ sub _mbox_write_cb ($$) {
         }
 }
 
-sub _maildir_each_file ($$;@) {
+sub maildir_each_file ($$;@) {
         my ($dir, $cb, @arg) = @_;
+        $dir .= '/' unless substr($dir, -1) eq '/';
         for my $d (qw(new/ cur/)) {
                 my $pfx = $dir.$d;
                 opendir my $dh, $pfx or next;
@@ -277,13 +278,13 @@ sub _maildir_each_file ($$;@) {
         }
 }
 
-sub _augment_file { # _maildir_each_file cb
+sub _augment_file { # maildir_each_file cb
         my ($f, $lei) = @_;
         my $eml = PublicInbox::InboxWritable::eml_from_path($f) or return;
         _augment($eml, $lei);
 }
 
-# _maildir_each_file callback, \&CORE::unlink doesn't work with it
+# maildir_each_file callback, \&CORE::unlink doesn't work with it
 sub _unlink { unlink($_[0]) }
 
 sub _rand () {
@@ -379,11 +380,11 @@ sub _do_augment_maildir {
                 my $dedupe = $lei->{dedupe};
                 if ($dedupe && $dedupe->prepare_dedupe) {
                         require PublicInbox::InboxWritable; # eml_from_path
-                        _maildir_each_file($dst, \&_augment_file, $lei);
+                        maildir_each_file($dst, \&_augment_file, $lei);
                         $dedupe->pause_dedupe;
                 }
         } else { # clobber existing Maildir
-                _maildir_each_file($dst, \&_unlink);
+                maildir_each_file($dst, \&_unlink);
         }
 }