@@ -198,6 +198,7 @@ module RFC3629
198
198
# ; revisions of this specification.
199
199
# flag-keyword = "$MDNSent" / "$Forwarded" / "$Junk" /
200
200
# "$NotJunk" / "$Phishing" / atom
201
+ #
201
202
# flag-perm = flag / "\*"
202
203
#
203
204
# Not checking for max one mbx-list-sflag in the parser.
@@ -220,19 +221,15 @@ module RFC3629
220
221
MBX_FLAG = FLAG_EXTENSION
221
222
222
223
# flag-list = "(" [flag *(SP flag)] ")"
223
- #
224
- # part of resp-text-code:
225
- # >>>
226
- # "PERMANENTFLAGS" SP "(" [flag-perm *(SP flag-perm)] ")"
227
- #
228
- # parens from mailbox-list are included in the regexp:
229
- # >>>
230
- # mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag
231
- # *(SP mbx-list-oflag) /
232
- # mbx-list-oflag *(SP mbx-list-oflag)
233
- FLAG_LIST = /\G \( (#{ FLAG } (?:#{ SP } #{ FLAG } )*|)\) /ni
234
- FLAG_PERM_LIST = /\G \( (#{ FLAG_PERM } (?:#{ SP } #{ FLAG_PERM } )*|)\) /ni
235
- MBX_LIST_FLAGS = /\G \( (#{ MBX_FLAG } (?:#{ SP } #{ MBX_FLAG } )*|)\) /ni
224
+ # resp-text-code =/ "PERMANENTFLAGS" SP
225
+ # "(" [flag-perm *(SP flag-perm)] ")"
226
+ # mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag
227
+ # *(SP mbx-list-oflag) /
228
+ # mbx-list-oflag *(SP mbx-list-oflag)
229
+ # (Not checking for max one mbx-list-sflag in the parser.)
230
+ FLAG_LIST = /\G \( (#{ FLAG } (?:#{ SP } #{ FLAG } )*|)\) /ni
231
+ FLAG_PERM_LIST = /\G \( (#{ FLAG_PERM } (?:#{ SP } #{ FLAG_PERM } )*|)\) /ni
232
+ MBX_LIST_FLAGS = /\G (#{ MBX_FLAG } (?:#{ SP } #{ MBX_FLAG } )*) /nix
236
233
237
234
# RFC3501:
238
235
# QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> /
@@ -1350,18 +1347,17 @@ def mailbox_data__list
1350
1347
alias mailbox_data__lsub mailbox_data__list
1351
1348
alias mailbox_data__xlist mailbox_data__list
1352
1349
1350
+ # mailbox-list = "(" [mbx-list-flags] ")" SP
1351
+ # (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox
1352
+ # [SP mbox-list-extended]
1353
+ # ; This is the list information pointed to by the ABNF
1354
+ # ; item "mailbox-data", which is defined above
1353
1355
def mailbox_list
1354
- attr = flag_list
1355
- match ( T_SPACE )
1356
- token = match ( T_QUOTED , T_NIL )
1357
- if token . symbol == T_NIL
1358
- delim = nil
1359
- else
1360
- delim = token . value
1361
- end
1362
- match ( T_SPACE )
1363
- name = astring
1364
- return MailboxList . new ( attr , delim , name )
1356
+ lpar ; attr = peek_rpar? ? [ ] : mbx_list_flags ; rpar
1357
+ SP! ; delim = nquoted
1358
+ SP! ; name = mailbox
1359
+ # TODO: mbox-list-extended
1360
+ MailboxList . new ( attr , delim , name )
1365
1361
end
1366
1362
1367
1363
def getquota_response
@@ -1941,22 +1937,10 @@ def flag_perm__list
1941
1937
. map! { _1 . start_with? ( "\\ " ) ? _1 [ 1 ..] . capitalize . to_sym : _1 }
1942
1938
end
1943
1939
1944
- # Not checking for max one mbx-list-sflag in the parser.
1945
- # >>>
1946
- # mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag
1947
- # *(SP mbx-list-oflag) /
1948
- # mbx-list-oflag *(SP mbx-list-oflag)
1949
- # mbx-list-oflag = "\Noinferiors" / child-mbox-flag /
1950
- # "\Subscribed" / "\Remote" / flag-extension
1951
- # ; Other flags; multiple from this list are
1952
- # ; possible per LIST response, but each flag
1953
- # ; can only appear once per LIST response
1954
- # mbx-list-sflag = "\NonExistent" / "\Noselect" / "\Marked" /
1955
- # "\Unmarked"
1956
- # ; Selectability flags; only one per LIST response
1957
- def parens__mbx_list_flags
1940
+ # See Patterns::MBX_LIST_FLAGS
1941
+ def mbx_list_flags
1958
1942
match_re ( Patterns ::MBX_LIST_FLAGS , "mbx-list-flags" ) [ 1 ]
1959
- . split ( nil ) . map! { _1 . capitalize . to_sym }
1943
+ . split ( nil ) . map! { _1 [ 1 .. ] . capitalize . to_sym }
1960
1944
end
1961
1945
1962
1946
# See https://developers.google.com/gmail/imap/imap-extensions
0 commit comments