From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS63949 45.79.64.0/19 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6DD151F428 for ; Tue, 4 Sep 2018 15:28:36 +0000 (UTC) Received: from meer.lwn.net (localhost [127.0.0.1]) by ms.lwn.net (Postfix) with ESMTPA id 3AD6B2DB; Tue, 4 Sep 2018 15:28:36 +0000 (UTC) From: Jonathan Corbet To: meta@public-inbox.org Cc: Jonathan Corbet Subject: [PATCH 2/2] Add Xrefs to over/xover lines Date: Tue, 4 Sep 2018 09:28:20 -0600 Message-Id: <20180904152820.15594-3-corbet@lwn.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180904152820.15594-1-corbet@lwn.net> References: <20180904152820.15594-1-corbet@lwn.net> List-Id: Putting the Xref field into xover lines allows newsreaders to mark cross-posted messages read when catching up a group. That, in turn, massively improves the life of crazy people who try to follow dozens of kernel lists, where emails are often heavily cross-posted. --- lib/PublicInbox/NNTP.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index cbd4ecf..022bb80 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -28,7 +28,7 @@ use constant { sub now () { clock_gettime(CLOCK_MONOTONIC) }; -my @OVERVIEW = qw(Subject From Date Message-ID References); +my @OVERVIEW = qw(Subject From Date Message-ID References Xref); my $OVERVIEW_FMT = join(":\r\n", @OVERVIEW, qw(Bytes Lines)) . ":\r\n"; my $LIST_HEADERS = join("\r\n", @OVERVIEW, qw(:bytes :lines Xref To Cc)) . "\r\n"; @@ -812,8 +812,8 @@ sub cmd_xrover ($;$) { }); } -sub over_line ($$) { - my ($num, $smsg) = @_; +sub over_line ($$$$) { + my ($self, $ng, $num, $smsg) = @_; # n.b. field access and procedural calls can be # 10%-15% faster than OO method calls: my $s = join("\t", $num, @@ -823,7 +823,8 @@ sub over_line ($$) { "<$smsg->{mid}>", $smsg->{references}, $smsg->{bytes}, - $smsg->{lines}); + $smsg->{lines}, + "Xref: " . xref($self, $ng, $num, $smsg->{mid})); utf8::encode($s); $s } @@ -839,7 +840,7 @@ sub cmd_over ($;$) { # Only set article number column if it's the current group my $self_ng = $self->{ng}; $n = 0 if (!$self_ng || $self_ng ne $ng); - more($self, over_line($n, $smsg)); + more($self, over_line($self, $ng, $n, $smsg)); '.'; } else { cmd_xover($self, $range); @@ -861,7 +862,7 @@ sub cmd_xover ($;$) { # OVERVIEW.FMT more($self, join("\r\n", map { - over_line($_->{num}, $_); + over_line($self, $self->{ng}, $_->{num}, $_); } @$msgs)); $cur = $msgs->[-1]->{num} + 1; }); -- 2.17.1