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.
sub now () { clock_gettime(CLOCK_MONOTONIC) };
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";
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";
-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,
# n.b. field access and procedural calls can be
# 10%-15% faster than OO method calls:
my $s = join("\t", $num,
"<$smsg->{mid}>",
$smsg->{references},
$smsg->{bytes},
"<$smsg->{mid}>",
$smsg->{references},
$smsg->{bytes},
+ $smsg->{lines},
+ "Xref: " . xref($self, $ng, $num, $smsg->{mid}));
# 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);
# 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);
'.';
} else {
cmd_xover($self, $range);
# OVERVIEW.FMT
more($self, join("\r\n", map {
# OVERVIEW.FMT
more($self, join("\r\n", map {
- over_line($_->{num}, $_);
+ over_line($self, $self->{ng}, $_->{num}, $_);
} @$msgs));
$cur = $msgs->[-1]->{num} + 1;
});
} @$msgs));
$cur = $msgs->[-1]->{num} + 1;
});
'<nntp@example.com>',
'<reftabsqueezed>',
$len,
'<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",
is_deeply($n->xover('1'), {
'1' => ["Testing for El\xc3\xa9anor",
'<nntp@example.com>',
'<reftabsqueezed>',
$len,
'<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');
is_deeply($n->head(1), $n->head('<nntp@example.com>'), 'HEAD OK');
is_deeply($n->body(1), $n->body('<nntp@example.com>'), 'BODY OK');
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" .
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');
}
'OVER by Message-ID works');
is($r[2], '.', 'correctly terminated response');
}