1 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # pretend to do PublicInbox::Import::add for "lei index"
5 package PublicInbox::FakeImport;
7 use PublicInbox::ContentHash qw(git_sha);
9 sub new { bless { bytes_added => 0 }, __PACKAGE__ }
12 my ($self, $eml, $check_cb, $smsg) = @_;
13 $smsg->populate($eml);
14 my $raw = $eml->as_string;
15 $smsg->{blob} = git_sha(1, \$raw)->hexdigest;
16 $smsg->set_bytes($raw, length($raw));
17 if (my $oidx = delete $smsg->{-oidx}) { # used by LeiStore
18 $oidx->vivify_xvmd($smsg) or return;