diff options
author | Eric Wong <e@80x24.org> | 2021-09-15 21:19:42 -0500 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-16 04:29:18 +0000 |
commit | ddfa726e55411277c5f8fda6a5f2c82d062b3fe2 (patch) | |
tree | 4740430538bcf6b5a94e87228658c29dcc7edb1d /lib | |
parent | b6e7a0d8f8ac22ef82754829a069096c858b8966 (diff) | |
download | public-inbox-ddfa726e55411277c5f8fda6a5f2c82d062b3fe2.tar.gz |
Otherwise, public-inbox-imapd will emit mailboxes in random order (as IMAP servers do not need to guarantee any sort of ordering). We'll take into account numeric slice numbers generated by -imapd if they exist, so slice "80" doesn't show up next to "8".
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/LeiLsMailSource.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiLsMailSource.pm b/lib/PublicInbox/LeiLsMailSource.pm index 71e253d9..f012e10e 100644 --- a/lib/PublicInbox/LeiLsMailSource.pm +++ b/lib/PublicInbox/LeiLsMailSource.pm @@ -27,6 +27,12 @@ sub input_path_url { # overrides LeiInput version my $sec = $lei->{net}->can('uri_section')->($uri); my $mic = $lei->{net}->mic_get($uri); my $l = $mic->folders_hash($uri->path); # server-side filter + @$l = map { $_->[2] } # undo Schwartzian transform below: + sort { $a->[0] cmp $b->[0] || $a->[1] <=> $b->[1] } + map { # prepare to sort -imapd slices numerically + $_->{name} =~ /\A(.+?)\.([0-9]+)\z/ ? + [ $1, $2 + 0, $_ ] : [ $_->{name}, -1, $_ ]; + } @$l; @f = map { "$sec/$_->{name}" } @$l; if ($json) { $_->{url} = "$sec/$_->{name}" for @$l; |