1 # Copyright (C) 2016 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # represents an NNTPD (currently a singleton),
5 # see script/public-inbox-nntpd for how it is used
6 package PublicInbox::NNTPD;
9 require PublicInbox::Config;
21 sub refresh_groups () {
23 my $pi_config = PublicInbox::Config->new;
26 foreach my $k (keys %$pi_config) {
27 $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next;
29 my $git_dir = $pi_config->{$k};
30 my $ngname = $pi_config->{"publicinbox.$name.newsgroup"};
31 next unless defined $ngname;
32 next if ($ngname eq ''); # disabled
33 my $ng = $pi_config->lookup_newsgroup($ngname) or next;
35 # Only valid if msgmap and search works
36 if ($ng->nntp_usable) {
37 $new->{$ngname} = $ng;
41 @list = sort { $a->{newsgroup} cmp $b->{newsgroup} } @list;
42 $self->{grouplist} = \@list;
43 # this will destroy old groups that got deleted
44 %{$self->{groups}} = %$new;