user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
c6a0e7a8d208de5d3103d7ad5ac2c6b4244d20af blob 521 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>

# Maildirs for now, MH eventually
package PublicInbox::MdirReader;
use strict;
use v5.10.1;

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;
		while (defined(my $fn = readdir($dh))) {
			$cb->($pfx.$fn, @arg) if $fn =~ /:2,[A-Za-z]*\z/;
		}
	}
}

1;
debug log:

solving c6a0e7a8 ...
found c6a0e7a8 in https://80x24.org/public-inbox.git

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).