Skip to content

Commit e2d3adc

Browse files
committed
♻️ Simplify CAPABILITY response code parsing
1 parent 509a71c commit e2d3adc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/net/imap/response_parser.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,11 +1346,13 @@ def enable_data
13461346
end
13471347

13481348
# As a workaround for buggy servers, allow a trailing SP:
1349-
# *(SP capapility) [SP]
1349+
# *(SP capability) [SP]
13501350
def capability__list
1351-
data = []; while _ = SP? && capability? do data << _ end; data
1351+
list = []; while SP? && (capa = capability?) do list << capa end; list
13521352
end
13531353

1354+
alias resp_code__capability capability__list
1355+
13541356
# capability = ("AUTH=" auth-type) / atom
13551357
# ; New capabilities MUST begin with "X" or be
13561358
# ; registered with IANA as standard or
@@ -1498,7 +1500,7 @@ def resp_text_code
14981500
name = resp_text_code__name
14991501
data =
15001502
case name
1501-
when "CAPABILITY" then capability__list
1503+
when "CAPABILITY" then resp_code__capability
15021504
when "PERMANENTFLAGS" then SP!; flag_list
15031505
when "UIDVALIDITY" then SP!; number
15041506
when "UIDNEXT" then SP!; number

0 commit comments

Comments
 (0)