about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTPD.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/NNTPD.pm')
-rw-r--r--lib/PublicInbox/NNTPD.pm25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm
index f31d4381..9e232ef6 100644
--- a/lib/PublicInbox/NNTPD.pm
+++ b/lib/PublicInbox/NNTPD.pm
@@ -13,21 +13,10 @@ use PublicInbox::NNTP;
 
 sub new {
         my ($class) = @_;
-        my $pi_cfg = PublicInbox::Config->new;
-        my $name = $pi_cfg->{'publicinbox.nntpserver'};
-        if (!defined($name) or $name eq '') {
-                $name = hostname;
-        } elsif (ref($name) eq 'ARRAY') {
-                $name = $name->[0];
-        }
-
         bless {
-                groups => {},
                 err => \*STDERR,
                 out => \*STDOUT,
-                pi_cfg => $pi_cfg,
-                servername => $name,
-                greet => \"201 $name ready - post via email\r\n",
+                # pi_cfg => $pi_cfg,
                 # accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... }
                 # idler => PublicInbox::InboxIdle
         }, $class;
@@ -35,7 +24,17 @@ sub new {
 
 sub refresh_groups {
         my ($self, $sig) = @_;
-        my $pi_cfg = $sig ? PublicInbox::Config->new : $self->{pi_cfg};
+        my $pi_cfg = PublicInbox::Config->new;
+        my $name = $pi_cfg->{'publicinbox.nntpserver'};
+        if (!defined($name) or $name eq '') {
+                $name = hostname;
+        } elsif (ref($name) eq 'ARRAY') {
+                $name = $name->[0];
+        }
+        if ($name ne ($self->{servername} // '')) {
+                $self->{servername} = $name;
+                $self->{greet} = \"201 $name ready - post via email\r\n";
+        }
         my $groups = $pi_cfg->{-by_newsgroup}; # filled during each_inbox
         my $cache = eval { $pi_cfg->ALL->misc->nntpd_cache_load } // {};
         $pi_cfg->each_inbox(sub {