user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
cc3e83e7e303b8d61c468298f9f0ff1bcaf67f5d blob 1613 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
# Copyright (C) 2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>

# front-end for the "lei index" sub-command, this is similar to
# "lei import" but doesn't put a git blob into ~/.local/share/lei/store
package PublicInbox::LeiIndex;
use strict;
use v5.10.1;
use parent qw(PublicInbox::IPC PublicInbox::LeiInput);
use PublicInbox::LeiImport;

# /^input_/ subs are used by (or override) PublicInbox::LeiInput superclass
sub input_eml_cb { # used by input_maildir_cb and input_net_cb
	my ($self, $eml, $vmd) = @_;
	my $xoids = $self->{lei}->{ale}->xoids_for($eml);
	if (my $all_vmd = $self->{all_vmd}) {
		@$vmd{keys %$all_vmd} = values %$all_vmd;
	}
	$self->{lei}->{sto}->ipc_do('index_eml_only', $eml, $vmd, $xoids);
}

sub input_fh { # overrides PublicInbox::LeiInput::input_fh
	my ($self, $ifmt, $fh, $input, @args) = @_;
	$self->{lei}->child_error(1<<8, <<EOM);
$input ($ifmt) not yet supported, try `lei import'
EOM
}

sub lei_index {
	my ($lei, @argv) = @_;
	$lei->{opt}->{'mail-sync'} = 1;
	my $self = bless {}, __PACKAGE__;
	PublicInbox::LeiImport::do_import_index($self, $lei, @argv);
}

no warnings 'once';
no strict 'refs';
for my $m (qw(input_maildir_cb input_net_cb)) {
	*$m = PublicInbox::LeiImport->can($m);
}

*_complete_import = \&PublicInbox::LeiImport::_complete_import;
*ipc_atfork_child = \&PublicInbox::LeiInput::input_only_atfork_child;
*net_merge_all_done = \&PublicInbox::LeiInput::input_only_net_merge_all_done;

# the following works even when LeiAuth is lazy-loaded
*net_merge_all = \&PublicInbox::LeiAuth::net_merge_all;
1;
debug log:

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