diff options
author | Eric Wong <e@80x24.org> | 2021-04-23 07:22:01 -0400 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-04-23 20:55:38 +0000 |
commit | aaa4b3a3fd2d7805afd412b3de2fca07a5e8898e (patch) | |
tree | 79264102d4305a395df554af0fb31ca702fdbc30 /lib/PublicInbox/LeiImport.pm | |
parent | 0831cd4c510deb97e755aa09a808bcf5f9e9deeb (diff) | |
download | public-inbox-aaa4b3a3fd2d7805afd412b3de2fca07a5e8898e.tar.gz |
This saves some work and makes it easier to set volatile metadata on a message at import time.
Diffstat (limited to 'lib/PublicInbox/LeiImport.pm')
-rw-r--r-- | lib/PublicInbox/LeiImport.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index accf08f5..e3c756e8 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -12,6 +12,10 @@ use parent qw(PublicInbox::IPC PublicInbox::LeiInput); sub input_eml_cb { # used by PublicInbox::LeiInput::input_fh my ($self, $eml, $vmd) = @_; my $xoids = $self->{lei}->{ale}->xoids_for($eml); + if (my $all_vmd = $self->{all_vmd}) { + $vmd //= {}; + @$vmd{keys %$all_vmd} = values %$all_vmd; + } $self->{lei}->{sto}->ipc_do('set_eml', $eml, $vmd, $xoids); } @@ -53,6 +57,9 @@ sub lei_import { # the main "lei import" method $sto->write_prepare($lei); my $self = bless {}, __PACKAGE__; $self->{-import_kw} = $lei->{opt}->{kw} // 1; + my $vmd_mod = $self->vmd_mod_extract(\@inputs); + return $lei->fail(join("\n", @{$vmd_mod->{err}})) if $vmd_mod->{err}; + $self->{all_vmd} = $vmd_mod if scalar keys %$vmd_mod; $self->prepare_inputs($lei, \@inputs) or return; $lei->ale; # initialize for workers to read my $j = $lei->{opt}->{jobs} // scalar(@{$self->{inputs}}) || 1; |