diff options
author | Eric Wong <e@80x24.org> | 2016-05-28 01:57:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-28 01:57:39 +0000 |
commit | 528230a0411897a14cbb79d0dae02ea89827bf1e (patch) | |
tree | ae71b388a84c8a8526b1908e77b00cb57d2cd340 /lib/PublicInbox/NNTPD.pm | |
parent | 666b537fb9d3984370d75f16eae43c2ced752963 (diff) | |
download | public-inbox-528230a0411897a14cbb79d0dae02ea89827bf1e.tar.gz |
Most of its functionality is in the PublicInbox::Inbox class. While we're at it, we no longer auto-create newsgroup names based on the inbox name, since newsgroup names probably deserve some thought when it comes to hierarchy.
Diffstat (limited to 'lib/PublicInbox/NNTPD.pm')
-rw-r--r-- | lib/PublicInbox/NNTPD.pm | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm index fc26c5c0..50d022be 100644 --- a/lib/PublicInbox/NNTPD.pm +++ b/lib/PublicInbox/NNTPD.pm @@ -6,7 +6,6 @@ package PublicInbox::NNTPD; use strict; use warnings; -require PublicInbox::NewsGroup; require PublicInbox::Config; sub new { @@ -26,28 +25,16 @@ sub refresh_groups () { my @list; foreach my $k (keys %$pi_config) { $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next; - my $g = $1; + my $name = $1; my $git_dir = $pi_config->{$k}; - my $addr = $pi_config->{"publicinbox.$g.address"}; - my $ngname = $pi_config->{"publicinbox.$g.newsgroup"}; - my $url = $pi_config->{"publicinbox.$g.url"}; - if (defined $ngname) { - next if ($ngname eq ''); # disabled - $g = $ngname; - } - my $ng = PublicInbox::NewsGroup->new($g, $git_dir, $addr, $url); - my $old_ng = $self->{groups}->{$g}; - - # Reuse the old one if possible since it can hold - # references to valid mm and gcf objects - if ($old_ng) { - $old_ng->update($ng); - $ng = $old_ng; - } + my $ngname = $pi_config->{"publicinbox.$name.newsgroup"}; + next unless defined $ngname; + next if ($ngname eq ''); # disabled + my $ng = $pi_config->lookup_newsgroup($ngname) or next; # Only valid if msgmap and search works - if ($ng->usable) { - $new->{$g} = $ng; + if ($ng->nntp_usable) { + $new->{$ngname} = $ng; push @list, $ng; } } |