]> Sergey Matveev's repositories - public-inbox.git/blobdiff - public-inbox-nntpd
mbox: generate Archived-At, List-Post, List-Archive headers
[public-inbox.git] / public-inbox-nntpd
old mode 100644 (file)
new mode 100755 (executable)
index f6042c2..0035637
@@ -6,6 +6,7 @@ use warnings;
 require PublicInbox::Daemon;
 require PublicInbox::NewsGroup;
 require PublicInbox::NNTP;
+require PublicInbox::Config;
 my $nntpd = PublicInbox::NNTPD->new;
 daemon_run('0.0.0.0:119',
        sub { $nntpd->refresh_groups },
@@ -15,21 +16,19 @@ daemon_run('0.0.0.0:119',
 package PublicInbox::NNTPD;
 use strict;
 use warnings;
-use fields qw(groups grouplist err out);
 
 sub new {
        my ($class) = @_;
-       my $self = fields::new($class);
-       $self->{groups} = {};
-       $self->{err} = \*STDERR;
-       $self->{out} = \*STDOUT;
-       $self->{grouplist} = [];
-       $self;
+       bless {
+               groups => {},
+               err => \*STDERR,
+               out => \*STDOUT,
+               grouplist => [],
+       }, $class;
 }
 
 sub refresh_groups () {
        my ($self) = @_;
-       require PublicInbox::Config;
        my $pi_config = PublicInbox::Config->new;
        my $new = {};
        my @list;
@@ -53,8 +52,8 @@ sub refresh_groups () {
                        $ng = $old_ng;
                }
 
-               # Only valid if Msgmap works
-               if ($ng->mm(1)) {
+               # Only valid if msgmap and search works
+               if ($ng->usable) {
                        $new->{$g} = $ng;
                        push @list, $ng;
                }