]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTP.pm
nntpd+imapd: detect replaced over.sqlite3
[public-inbox.git] / lib / PublicInbox / NNTP.pm
index 54207500dd8db5576658ae993169efd10318fdc5..bffd773cf9eb087c5d990fed67db0da10e2ff345 100644 (file)
@@ -296,7 +296,7 @@ sub newnews_i {
        my $msgs = $over->query_ts($ts, $$prev);
        if (scalar @$msgs) {
                more($self, '<' .
-                       join(">\r\n<", map { $_->mid } @$msgs ).
+                       join(">\r\n<", map { $_->{mid} } @$msgs ).
                        '>');
                $$prev = $msgs->[-1]->{num};
        } else {
@@ -334,7 +334,9 @@ sub cmd_newnews ($$$$;$$) {
 sub cmd_group ($$) {
        my ($self, $group) = @_;
        my $no_such = '411 no such news group';
-       my $ng = $self->{nntpd}->{groups}->{$group} or return $no_such;
+       my $nntpd = $self->{nntpd};
+       my $ng = $nntpd->{groups}->{$group} or return $no_such;
+       $nntpd->idler_start;
 
        $self->{ng} = $ng;
        my ($min, $max) = $ng->mm->minmax;
@@ -722,8 +724,16 @@ sub smsg_range_i {
        my $msgs = $over->query_xover($$beg, $end);
        scalar(@$msgs) or return;
        my $tmp = '';
-       foreach my $s (@$msgs) {
-               $tmp .= $s->{num} . ' ' . $s->$field . "\r\n";
+
+       # ->{$field} is faster than ->$field invocations, so favor that.
+       if ($field eq 'date') {
+               for my $s (@$msgs) {
+                       $tmp .= "$s->{num} ".PublicInbox::Smsg::date($s)."\r\n"
+               }
+       } else {
+               for my $s (@$msgs) {
+                       $tmp .= "$s->{num} $s->{$field}\r\n";
+               }
        }
        utf8::encode($tmp);
        $self->msg_more($tmp);