user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH v2 0/2] Make NNTP Xrefs work better
  2018-10-13 21:42  6% [PATCH v2 0/2] Make NNTP Xrefs work better Jonathan Corbet
  2018-10-13 21:42  6% ` [PATCH 2/2] Add Xrefs to over/xover lines Jonathan Corbet
@ 2018-10-16  4:04  0% ` Eric Wong
  1 sibling, 0 replies; 5+ results
From: Eric Wong @ 2018-10-16  4:04 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: meta

Jonathan Corbet <corbet@lwn.net> wrote:
> I finally found some time to figure out why the Xref changes weren't having
> the desired effect for me; the result is the following two changes.
> 
> As always, these patches are likely to reveal that I really haven't done
> any perl in decades and that I'm still kind of groping my way around the
> public-inbox source.  Hopefully they aren't too bad...

No worries, Perl (or anything else) feels rusty to me after
only a few days/weeks away :x

> Version 2 makes the tests work and improves the setting of the server name.

Thanks!  Applied and pushed to https://public-inbox.org/ as
commit fbfd63996ddfc9a23b8a1e0f8756e378f2e196ba

> Jonathan Corbet (2):
>   Put the NNTP server name into Xref lines
>   Add Xrefs to over/xover lines

I was concerned about exposing the NNTP server hostname for
people running Tor onions, but having "publicinbox.nntpserver"
already-configured on my mirror onions means no changes were
needed on my end.  Other onion operators (if they exist) may
need to take notice.

I haven't deployed to news.public-inbox.org / ou63pmih66umazou.onion, yet;
but both nntp://hjrcffqmbrq6wope.onion/ and nntp://czquwvybam4bgbro.onion/
are running the new code.

^ permalink raw reply	[relevance 0%]

* [PATCH 2/2] Add Xrefs to over/xover lines
  2018-10-13 21:42  6% [PATCH v2 0/2] Make NNTP Xrefs work better Jonathan Corbet
@ 2018-10-13 21:42  6% ` Jonathan Corbet
  2018-10-16  4:04  0% ` [PATCH v2 0/2] Make NNTP Xrefs work better Eric Wong
  1 sibling, 0 replies; 5+ results
From: Jonathan Corbet @ 2018-10-13 21:42 UTC (permalink / raw)
  To: meta; +Cc: Eric Wong, Jonathan Corbet

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 +++++++------
 t/nntpd.t               | 11 ++++++++---
 2 files changed, 15 insertions(+), 9 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;
 	});
diff --git a/t/nntpd.t b/t/nntpd.t
index f859908..9c1d076 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -196,7 +196,9 @@ EOF
 			'<nntp@example.com>',
 			'<reftabsqueezed>',
 			$len,
-			'1' ] }, "XOVER range works");
+			'1',
+			'Xref: '. hostname . ' test-nntpd:1'] },
+		"XOVER range works");
 
 	is_deeply($n->xover('1'), {
 		'1' => ["Testing for El\xc3\xa9anor",
@@ -205,7 +207,9 @@ EOF
 			'<nntp@example.com>',
 			'<reftabsqueezed>',
 			$len,
-			'1' ] }, "XOVER by article works");
+			'1',
+			'Xref: '. hostname . ' test-nntpd:1'] },
+		"XOVER by article works");
 
 	is_deeply($n->head(1), $n->head('<nntp@example.com>'), 'HEAD OK');
 	is_deeply($n->body(1), $n->body('<nntp@example.com>'), 'BODY OK');
@@ -225,7 +229,8 @@ EOF
 		is($r[1], "0\tTesting for El\xc3\xa9anor\t" .
 			"El\xc3\xa9anor <me\@example.com>\t" .
 			"Thu, 01 Jan 1970 06:06:06 +0000\t" .
-			"$mid\t<reftabsqueezed>\t$len\t1",
+			"$mid\t<reftabsqueezed>\t$len\t1" .
+			"\tXref: " . hostname . " test-nntpd:0",
 			'OVER by Message-ID works');
 		is($r[2], '.', 'correctly terminated response');
 	}
-- 
2.17.2


^ permalink raw reply related	[relevance 6%]

* [PATCH v2 0/2] Make NNTP Xrefs work better
@ 2018-10-13 21:42  6% Jonathan Corbet
  2018-10-13 21:42  6% ` [PATCH 2/2] Add Xrefs to over/xover lines Jonathan Corbet
  2018-10-16  4:04  0% ` [PATCH v2 0/2] Make NNTP Xrefs work better Eric Wong
  0 siblings, 2 replies; 5+ results
From: Jonathan Corbet @ 2018-10-13 21:42 UTC (permalink / raw)
  To: meta; +Cc: Eric Wong, Jonathan Corbet

I finally found some time to figure out why the Xref changes weren't having
the desired effect for me; the result is the following two changes.

As always, these patches are likely to reveal that I really haven't done
any perl in decades and that I'm still kind of groping my way around the
public-inbox source.  Hopefully they aren't too bad...

Version 2 makes the tests work and improves the setting of the server name.


Jonathan Corbet (2):
  Put the NNTP server name into Xref lines
  Add Xrefs to over/xover lines

 lib/PublicInbox/NNTP.pm  | 17 +++++++++--------
 lib/PublicInbox/NNTPD.pm |  6 ++++++
 2 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.17.1


^ permalink raw reply	[relevance 6%]

* [PATCH 2/2] Add Xrefs to over/xover lines
  2018-09-04 15:28  6% [PATCH 0/2] Make NNTP Xrefs work better Jonathan Corbet
@ 2018-09-04 15:28  7% ` Jonathan Corbet
  0 siblings, 0 replies; 5+ results
From: Jonathan Corbet @ 2018-09-04 15:28 UTC (permalink / raw)
  To: meta; +Cc: Jonathan Corbet

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


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] Make NNTP Xrefs work better
@ 2018-09-04 15:28  6% Jonathan Corbet
  2018-09-04 15:28  7% ` [PATCH 2/2] Add Xrefs to over/xover lines Jonathan Corbet
  0 siblings, 1 reply; 5+ results
From: Jonathan Corbet @ 2018-09-04 15:28 UTC (permalink / raw)
  To: meta; +Cc: Jonathan Corbet

I finally found some time to figure out why the Xref changes weren't having
the desired effect for me; the result is the following two changes.

As always, these patches are likely to reveal that I really haven't done
any perl in decades and that I'm still kind of groping my way around the
public-inbox source.  Hopefully they aren't too bad...


Jonathan Corbet (2):
  Put the NNTP server name into Xref lines
  Add Xrefs to over/xover lines

 lib/PublicInbox/NNTP.pm  | 17 +++++++++--------
 lib/PublicInbox/NNTPD.pm |  6 ++++++
 2 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.17.1


^ permalink raw reply	[relevance 6%]

Results 1-5 of 5 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-09-04 15:28  6% [PATCH 0/2] Make NNTP Xrefs work better Jonathan Corbet
2018-09-04 15:28  7% ` [PATCH 2/2] Add Xrefs to over/xover lines Jonathan Corbet
2018-10-13 21:42  6% [PATCH v2 0/2] Make NNTP Xrefs work better Jonathan Corbet
2018-10-13 21:42  6% ` [PATCH 2/2] Add Xrefs to over/xover lines Jonathan Corbet
2018-10-16  4:04  0% ` [PATCH v2 0/2] Make NNTP Xrefs work better Eric Wong

Code repositories for project(s) associated with this public 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).