]> Sergey Matveev's repositories - public-inbox.git/commitdiff
net_reader: nntp_each: pass keywords as `undef'
authorEric Wong <e@80x24.org>
Tue, 23 Mar 2021 11:48:04 +0000 (11:48 +0000)
committerEric Wong <e@80x24.org>
Wed, 24 Mar 2021 01:33:26 +0000 (01:33 +0000)
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

index bc2110291c07123d21a51bb7ec7ae3c0d2dee670..6a52b479d68caa904728b61a0d079d007999b2da 100644 (file)
@@ -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);