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-27 09:52:46 +0000
committerEric Wong <e@80x24.org>2020-11-28 04:53:15 +0000
commit7b20e5135238a2780ac3df3198a02e9fbda4ba18 (patch)
tree609fe44b68be49cb9e0cbd46dbe45bb5f32d6b48 /lib/PublicInbox/NNTP.pm
parentac43c3b17f452b02edf1cce3632a433e998de5ca (diff)
downloadpublic-inbox-7b20e5135238a2780ac3df3198a02e9fbda4ba18.tar.gz
Based on experiences with the IMAP server, this ought to be
significantly faster (as to be demonstrated in the next
commit).
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index b641bd23..68222196 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -136,29 +136,29 @@ sub list_headers ($;$) {
 sub list_active ($;$) {
         my ($self, $wildmat) = @_;
         wildmat2re($wildmat);
-        foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
-                $ng->{newsgroup} =~ $wildmat or next;
-                group_line($self, $ng);
+        my $groups = $self->{nntpd}->{groups};
+        for my $ngname (grep(/$wildmat/, @{$self->{nntpd}->{groupnames}})) {
+                group_line($self, $groups->{$ngname});
         }
 }
 
 sub list_active_times ($;$) {
         my ($self, $wildmat) = @_;
         wildmat2re($wildmat);
-        foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
-                $ng->{newsgroup} =~ $wildmat or next;
-                my $c = eval { $ng->uidvalidity } // time;
-                more($self, "$ng->{newsgroup} $c $ng->{-primary_address}");
+        my $groups = $self->{nntpd}->{groups};
+        for my $ngname (grep(/$wildmat/, @{$self->{nntpd}->{groupnames}})) {
+                my $ibx = $groups->{$ngname};
+                my $c = eval { $ibx->uidvalidity } // time;
+                more($self, "$ngname $c $ibx->{-primary_address}");
         }
 }
 
 sub list_newsgroups ($;$) {
         my ($self, $wildmat) = @_;
         wildmat2re($wildmat);
-        foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
-                $ng->{newsgroup} =~ $wildmat or next;
-                my $d = $ng->description;
-                more($self, "$ng->{newsgroup} $d");
+        my $groups = $self->{nntpd}->{groups};
+        for my $ngname (grep(/$wildmat/, @{$self->{nntpd}->{groupnames}})) {
+                more($self, "$ngname ".$groups->{$ngname}->description);
         }
 }