]> Sergey Matveev's repositories - public-inbox.git/commitdiff
nntp: use Inbox->uidvalidity instead of ->mm->created_at
authorEric Wong <e@80x24.org>
Fri, 27 Nov 2020 09:52:43 +0000 (09:52 +0000)
committerEric Wong <e@80x24.org>
Sat, 28 Nov 2020 04:53:11 +0000 (04:53 +0000)
This is memoized, and may allow us some future flexibility w.r.t
PublicInbox::Inbox-like objects.  While we're at it, use
defined-or ("//") in case somebody really set a public-inbox
creation time to the Unix epoch.

lib/PublicInbox/NNTP.pm

index 2f821fa6b9b51902ddc221c9ca3f225d06e708af..2197d7588721048fcbb9015e3b46bfddce13ad40 100644 (file)
@@ -147,7 +147,7 @@ sub list_active_times ($;$) {
        wildmat2re($wildmat);
        foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
                $ng->{newsgroup} =~ $wildmat or next;
-               my $c = eval { $ng->mm->created_at } || time;
+               my $c = eval { $ng->uidvalidity } // time;
                more($self, "$ng->{newsgroup} $c $ng->{-primary_address}");
        }
 }
@@ -255,7 +255,7 @@ sub cmd_newgroups ($$$;$$) {
        # TODO dists
        more($self, '231 list of new newsgroups follows');
        foreach my $ng (@{$self->{nntpd}->{grouplist}}) {
-               my $c = eval { $ng->mm->created_at } || 0;
+               my $c = eval { $ng->uidvalidity } // 0;
                next unless $c > $ts;
                group_line($self, $ng);
        }