]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/IMAPD.pm
imapd: don't bother sorting LIST output
[public-inbox.git] / lib / PublicInbox / IMAPD.pm
index b647c94050512007132da6df9e84d620d360d501..09bedf5ca9b42c7b74129a94bab7b50b5df0acc3 100644 (file)
@@ -31,7 +31,7 @@ sub imapd_refresh_ibx { # pi_config->each_inbox cb
                        join(', ', @$ngname). "\n";
                return;
        } elsif ($ngname =~ m![^a-z0-9/_\.\-\~\@\+\=:]! ||
-                $ngname =~ /\.[0-9]+-[0-9]+\z/) {
+                $ngname =~ /\.[0-9]+\z/) {
                warn "mailbox name invalid: newsgroup=`$ngname'\n";
                return;
        }
@@ -44,7 +44,7 @@ sub imapd_refresh_ibx { # pi_config->each_inbox cb
        # this case is a 32-bit representation of the creation
        # date/time of the mailbox"
        defined($ibx->{uidvalidity} = $mm->created_at) or return;
-       PublicInbox::IMAP::ensure_ranges_exist($imapd, $ibx, $mm->max // 1);
+       PublicInbox::IMAP::ensure_slices_exist($imapd, $ibx, $mm->max // 0);
 
        # preload to avoid fragmentation:
        $ibx->description;
@@ -71,8 +71,10 @@ sub imapd_refresh_finalize {
        $imapd->{inboxlist} = [
                map {
                        my $no = $mailboxes->{$_} == $dummy ? '' : 'No';
-                       qq[* LIST (\\Has${no}Children) "." $_\r\n]
-               } sort { length($a) <=> length($b) } keys %$mailboxes
+                       my $u = $_; # capitalize "INBOX" for user-familiarity
+                       $u =~ s/\Ainbox(\.|\z)/INBOX$1/i;
+                       qq[* LIST (\\Has${no}Children) "." $u\r\n]
+               } keys %$mailboxes
        ];
        $imapd->{pi_config} = $pi_config;
        if (my $idler = $imapd->{idler}) {