about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-22 10:09:46 +0000
committerEric Wong <e@80x24.org>2015-09-22 22:12:18 +0000
commit3c37d760722019323168cf2cd6425c0fddd76b0c (patch)
treecb78f6d3f133aaaf3f9a23309fc870ebb1b303e3 /lib
parent8a78da1a439938d9064775d27bb4dac6fd221220 (diff)
downloadpublic-inbox-3c37d760722019323168cf2cd6425c0fddd76b0c.tar.gz
This is just like the XOVER command, but allows a single Message-ID
to be given.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/NNTP.pm34
1 files changed, 28 insertions, 6 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index e5bb683a..1286b706 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -383,7 +383,7 @@ found:
                 # must be last
                 $s->body_set('') if ($set_headers == 2);
         }
-        [ $n, $mid, $s, $bytes, $lines ];
+        [ $n, $mid, $s, $bytes, $lines, $ng ];
 }
 
 sub simple_body_write ($$) {
@@ -701,6 +701,32 @@ sub cmd_xrover ($;$) {
         });
 }
 
+sub over_line {
+        my ($self, $r) = @_;
+
+        more($self, join("\t", $r->[0], map {
+                                my $h = xhdr($r, $_);
+                                defined $h ? $h : '';
+                        } @OVERVIEW ));
+}
+
+sub cmd_over ($;$) {
+        my ($self, $range) = @_;
+        if ($range && $range =~ /\A<.+>\z/) {
+                my $r = $self->art_lookup($range, 2);
+                return '430 No article with that message-id' unless ref $r;
+                more($self, '224 Overview information follows (multi-line)');
+
+                # Only set article number column if it's the current group
+                my $ng = $self->{ng};
+                $r->[0] = 0 if (!$ng || $ng ne $r->[5]);
+                over_line($self, $r);
+                '.';
+        } else {
+                cmd_xover($self, $range);
+        }
+}
+
 sub cmd_xover ($;$) {
         my ($self, $range) = @_;
         $range = $self->{article} unless defined $range;
@@ -712,11 +738,7 @@ sub cmd_xover ($;$) {
                 my ($i) = @_;
                 my $r = $self->art_lookup($$i, 2);
                 return unless ref $r;
-                more($self, join("\t", $r->[0],
-                                map {
-                                        my $h = xhdr($r, $_);
-                                        defined $h ? $h : '';
-                                } @OVERVIEW ));
+                over_line($self, $r);
         });
 }