about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-11-28 05:09:16 +0000
committerEric Wong <e@80x24.org>2020-11-29 02:25:51 +0000
commitbdef958bdccc4b1d11cd8408a5c29167b5385dc0 (patch)
treec8bf5c2770964f148e783c6a82f89e72de5d255d /lib/PublicInbox/NNTP.pm
parent2d3fc25afe7435992236ac143039b24248c5e74d (diff)
downloadpublic-inbox-bdef958bdccc4b1d11cd8408a5c29167b5385dc0.tar.gz
It's not worth confusing hackers reading the source to have
two ways to access the same (large) hash table.  So just
go through PublicInbox::Config objects for now since the
extra hash lookup isn't going to be noticeable.

I've also started favoring "for" instead of "foreach"
since they're the equivalent perlop and less wear on
my fingers + keyboard.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index d314a3d1..3b16a66a 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -321,7 +321,7 @@ sub ngpat2re (;$) {
 sub newnews_i {
         my ($self, $names, $ts, $prev) = @_;
         my $ngname = $names->[0];
-        if (my $ibx = $self->{nntpd}->{groups}->{$ngname}) {
+        if (my $ibx = $self->{nntpd}->{pi_config}->{-by_newsgroup}->{$ngname}) {
                 if (my $over = $ibx->over) {
                         my $msgs = $over->query_ts($ts, $$prev);
                         if (scalar @$msgs) {
@@ -360,13 +360,13 @@ sub cmd_newnews ($$$$;$$) {
 
 sub cmd_group ($$) {
         my ($self, $group) = @_;
-        my $no_such = '411 no such news group';
         my $nntpd = $self->{nntpd};
-        my $ng = $nntpd->{groups}->{$group} or return $no_such;
+        my $ibx = $nntpd->{pi_config}->{-by_newsgroup}->{$group} or
+                return '411 no such news group';
         $nntpd->idler_start;
 
-        $self->{ng} = $ng;
-        my ($min, $max) = $ng->mm->minmax;
+        $self->{ng} = $ibx;
+        my ($min, $max) = $ibx->mm->minmax;
         $self->{article} = $min;
         my $est_size = $max - $min;
         "211 $est_size $min $max $group";
@@ -743,7 +743,7 @@ EOF
                 }
                 # no warning here, $mid is just invalid
         } else { # slow path for non-ALL users
-                foreach my $ibx (values %{$self->{nntpd}->{groups}}) {
+                for my $ibx (values %{$pi_cfg->{-by_newsgroup}}) {
                         next if defined $self_ng && $ibx eq $self_ng;
                         my $n = $ibx->mm->num_for($mid);
                         return ($ibx, $n) if defined $n;