]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTP.pm
No ext_urls
[public-inbox.git] / lib / PublicInbox / NNTP.pm
index ef01f44886203abdeaa3b07dad35226a9e7d6770..7a91e7ebfe49d158080d3a3bbabc0c630b5997da 100644 (file)
@@ -15,7 +15,7 @@ use PublicInbox::MID qw(mid_escape $MID_EXTRACT);
 use PublicInbox::Eml;
 use POSIX qw(strftime);
 use PublicInbox::DS qw(now);
-use Digest::SHA qw(sha1_hex);
+use PublicInbox::SHA qw(sha1_hex);
 use Time::Local qw(timegm timelocal);
 use PublicInbox::GitAsyncCat;
 use PublicInbox::Address;
@@ -72,9 +72,8 @@ sub process_line ($$) {
        my $res = eval { $req->($self, @args) };
        my $err = $@;
        if ($err && $self->{sock}) {
-               local $/ = "\n";
-               chomp($l);
-               err($self, 'error from: %s (%s)', $l, $err);
+               $l =~ s/\r?\n//s;
+               warn("error from: $l ($err)\n");
                $res = \"503 program fault - command not performed\r\n";
        }
        defined($res) ? $self->write($res) : 0;
@@ -189,7 +188,7 @@ sub listgroup_range_i {
        my ($self, $beg, $end) = @_;
        my $r = $self->{ibx}->mm(1)->msg_range($beg, $end, 'num');
        scalar(@$r) or return;
-       $self->msg_more(join("\r\n", @$r, ''));
+       $self->msg_more(join('', map { "$_->[0]\r\n" } @$r));
        1;
 }
 
@@ -945,11 +944,6 @@ sub cmd_xpath ($$) {
        '223 '.join(' ', sort(@paths))."\r\n";
 }
 
-sub err ($$;@) {
-       my ($self, $fmt, @args) = @_;
-       printf { $self->{nntpd}->{err} } $fmt."\n", @args;
-}
-
 sub out ($$;@) {
        my ($self, $fmt, @args) = @_;
        printf { $self->{nntpd}->{out} } $fmt."\n", @args;