more($self, "$ng->{newsgroup} $max $min n");
}
+sub newgroups_i {
+ my ($self, $ts, $i, $groupnames) = @_;
+ my $end = $$i + 100;
+ my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+ while ($$i < $end) {
+ my $ngname = $groupnames->[$$i++] // return;
+ my $ibx = $groups->{$ngname} or next; # expired on reload
+ next unless (eval { $ibx->uidvalidity } // 0) > $ts;
+ group_line($self, $ibx);
+ }
+ 1;
+}
+
sub cmd_newgroups ($$$;$$) {
my ($self, $date, $time, $gmt, $dists) = @_;
my $ts = eval { parse_time($date, $time, $gmt) };
# TODO dists
more($self, '231 list of new newsgroups follows');
- foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
- my $c = eval { $ng->uidvalidity } // 0;
- next unless $c > $ts;
- group_line($self, $ng);
- }
- '.'
+ long_response($self, \&newgroups_i, $ts, \(my $i = 0),
+ $self->{nntpd}->{groupnames});
}
sub wildmat2re (;$) {
groups => {},
err => \*STDERR,
out => \*STDOUT,
- grouplist => [],
pi_config => $pi_config,
servername => $name,
greet => \"201 $name ready - post via email\r\n",
delete $groups->{$ngname};
}
});
- my @names = sort(keys %$groups);
- $self->{grouplist} = [ map { $groups->{$_} } @names ];
- $self->{groupnames} = \@names;
+ $self->{groupnames} = [ sort(keys %$groups) ];
$self->{pi_config} = $pi_config;
# this will destroy old groups that got deleted
$self->{groups} = $groups;
my $hdr = $mime->header_obj;
my $mock_self = {
nntpd => {
- grouplist => [],
servername => 'example.com',
pi_config => bless {}, 'PublicInbox::Config',
},