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

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

# pretend to do PublicInbox::Import::add for "lei index"
package PublicInbox::FakeImport;
use strict;
use PublicInbox::ContentHash qw(git_sha);

sub new { bless { bytes_added => 0 }, __PACKAGE__ }

sub add {
	my ($self, $eml, $check_cb, $smsg) = @_;
	$smsg->populate($eml);
	my $raw = $eml->as_string;
	$smsg->{blob} = git_sha(1, \$raw)->hexdigest;
	$smsg->set_bytes($raw, length($raw));
	if (my $oidx = delete $smsg->{-oidx}) { # used by LeiStore
		$oidx->vivify_xvmd($smsg) or return;
	}
	1;
}

1;
debug log:

solving dea25cbe ...
found dea25cbe in 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).