From b4bc9aeed78078feae58d150970fe224f10098e3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 16 Sep 2021 00:26:51 +0000 Subject: inbox: streamline ->nntp_url We no longer waste a precious hash slot for a per-Inbox {nntpserver} if it's only configured globally for all inboxes. --- lib/PublicInbox/Inbox.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/Inbox.pm') diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index b0bb9dcc..f234b96f 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -109,8 +109,6 @@ sub new { } else { delete $opts->{feedmax}; } - $opts->{nntpserver} ||= $pi_cfg->{'publicinbox.nntpserver'}; - # allow any combination of multi-line or comma-delimited hide entries my $hide = {}; if (defined(my $h = $opts->{hide})) { @@ -261,22 +259,21 @@ sub base_url { } sub nntp_url { - my ($self) = @_; + my ($self, $ctx) = @_; $self->{-nntp_url} ||= do { # no checking for nntp_usable here, we can point entirely # to non-local servers or users run by a different user - my $ns = $self->{nntpserver}; + my $ns = $self->{nntpserver} // + $ctx->{www}->{pi_cfg}->get_all('publicinbox.nntpserver'); my $group = $self->{newsgroup}; my @urls; if ($ns && $group) { - $ns = [ $ns ] if ref($ns) ne 'ARRAY'; @urls = map { my $u = m!\Anntps?://! ? $_ : "nntp://$_"; $u .= '/' if $u !~ m!/\z!; $u.$group; } @$ns; } - my $mirrors = $self->{nntpmirror}; if ($mirrors) { my @m; -- cgit v1.2.3-24-ge0c7