Skip to content

Commit 5a70326

Browse files
committed
⚡ Sort response-data case stmt
The case statement is sorted _roughly_ in the order of frequency... but I need to collect more data to reliably make a claim about that. In the meantime, this order made sense to me... more or less. Current standard (both RFC3501 and RFC9051) responses are sorted first, and deprecated, uncommon, unsupported, etc responses are sorted last.
1 parent 91bad4a commit 5a70326

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/net/imap/response_parser.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -488,29 +488,29 @@ def response_data
488488
m = peek_re(RE_RESPONSE_TYPE) or parse_error("unparsable response")
489489
case m["type"].upcase
490490
when "OK" then response_cond # RFC3501, RFC9051
491+
when "FETCH" then message_data__fetch # RFC3501, RFC9051
492+
when "EXPUNGE" then message_data__expunge # RFC3501, RFC9051
493+
when "EXISTS" then mailbox_data__exists # RFC3501, RFC9051
494+
when "SEARCH" then search_response # RFC3501 (obsolete)
495+
when "CAPABILITY" then capability_data__untagged # RFC3501, RFC9051
496+
when "FLAGS" then flags_response # RFC3501, RFC9051
497+
when "LIST" then list_response # RFC3501, RFC9051
498+
when "STATUS" then status_response # RFC3501, RFC9051
499+
when "NAMESPACE" then namespace_response # RFC2342, RFC9051
500+
when "ENABLED" then enable_data # RFC5161, RFC9051
491501
when "BAD" then response_cond # RFC3501, RFC9051
492502
when "NO" then response_cond # RFC3501, RFC9051
493503
when "PREAUTH" then response_cond # RFC3501, RFC9051
494504
when "BYE" then response_cond # RFC3501, RFC9051
495-
when "FLAGS" then flags_response # RFC3501, RFC9051
496-
when "ID" then id_response # RFC2971
497-
when "LIST" then list_response # RFC3501, RFC9051
498-
when "LSUB" then list_response # RFC3501 (obsolete)
499-
when "XLIST" then list_response # deprecated
500-
when "NAMESPACE" then namespace_response # RFC2342, RFC9051
505+
when "RECENT" then mailbox_data__recent # RFC3501 (obsolete)
506+
when "SORT" then sort_data # RFC5256, RFC7162
507+
when "THREAD" then thread_response # RFC5256
501508
when "QUOTA" then getquota_response # RFC2087, RFC9208
502509
when "QUOTAROOT" then getquotaroot_response # RFC2087, RFC9208
510+
when "ID" then id_response # RFC2971
503511
when "ACL" then getacl_response # RFC4314
504-
when "SEARCH" then search_response # RFC3501 (obsolete)
505-
when "SORT" then search_response # RFC5256, RFC7162
506-
when "THREAD" then thread_response # RFC5256
507-
when "STATUS" then status_response # RFC3501, RFC9051
508-
when "CAPABILITY" then capability_data__untagged # RFC3501, RFC9051
509-
when "ENABLED" then enable_data # RFC5161, RFC9051
510-
when "FETCH" then message_data__fetch # RFC3501, RFC9051
511-
when "EXPUNGE" then message_data__expunge # RFC3501, RFC9051
512-
when "EXISTS" then mailbox_data__exists # RFC3501, RFC9051
513-
when "RECENT" then mailbox_data__recent # RFC3501 (obsolete)
512+
when "LSUB" then list_response # RFC3501 (obsolete)
513+
when "XLIST" then list_response # deprecated
514514
when "NOOP" then ignored_response
515515
else unparsed_response
516516
end

0 commit comments

Comments
 (0)