From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E675D1F9FD for ; Tue, 23 Mar 2021 11:48:08 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/5] net_reader: nntp_each: pass keywords as `undef' Date: Tue, 23 Mar 2021 11:48:04 +0000 Message-Id: <20210323114808.7605-2-e@80x24.org> In-Reply-To: <20210323114808.7605-1-e@80x24.org> References: <20210323114808.7605-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We'll use `undef' to denote keywords are unknown/unsupported, instead of an empty arrayref. This will let callers use the same callback and args for imap_each. Passing an empty arrayref to set_eml in LeiStore causes keywords to be cleared completely, which is not desired behavior when "lei import" is importing already-seen messages from NNTP. --- lib/PublicInbox/NetReader.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index bc211029..6a52b479 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -554,11 +554,10 @@ sub _nntp_fetch_all ($$$) { return if $l_art >= $end; # nothing to do $beg = $l_art + 1; } - my ($err, $art); + my ($err, $art, $last_art, $kw); # kw stays undef, no keywords in NNTP unless ($self->{quiet}) { warn "# $uri fetching ARTICLE $beg..$end\n"; } - my $last_art; my $n = $self->{max_batch}; for ($beg..$end) { last if $self->{quit}; @@ -582,7 +581,7 @@ sub _nntp_fetch_all ($$$) { $raw = join('', @$raw); $raw =~ s/\r\n/\n/sg; my ($eml_cb, @args) = @{$self->{eml_each}}; - $eml_cb->($uri, $art, [], PublicInbox::Eml->new(\$raw), @args); + $eml_cb->($uri, $art, $kw, PublicInbox::Eml->new(\$raw), @args); $last_art = $art; } run_commit_cb($self);