From 4d1a787a0a3c27a11c266b2f76293d09b858b38e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 10 Jun 2020 07:04:41 +0000 Subject: imapd: ensure LIST is sorted alphabetically, for now I'm not sure this matters, and it could be a waste of CPU cycles if no real clients care. However, it does make debugging over telnet or s_client a bit easier. --- lib/PublicInbox/IMAPD.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/IMAPD.pm') diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm index b647c940..6488dc0f 100644 --- a/lib/PublicInbox/IMAPD.pm +++ b/lib/PublicInbox/IMAPD.pm @@ -72,7 +72,12 @@ sub imapd_refresh_finalize { map { my $no = $mailboxes->{$_} == $dummy ? '' : 'No'; qq[* LIST (\\Has${no}Children) "." $_\r\n] - } sort { length($a) <=> length($b) } keys %$mailboxes + } sort { + # shortest names first, alphabetically if lengths match + length($a) == length($b) ? + ($a cmp $b) : + (length($a) <=> length($b)) + } keys %$mailboxes ]; $imapd->{pi_config} = $pi_config; if (my $idler = $imapd->{idler}) { -- cgit v1.2.3-24-ge0c7