; Extended data item (mbox-list-extended-item) returned when the RECURSIVEMATCH selection option is specified.
; Note 1: the CHILDINFO tag can be returned with and without surrounding quotes, as per mbox-list-extended-item-tag production.
; Note 2: The selection options are always returned quoted, unlike their specification in the extended LIST command.
childinfo-extended-item = "CHILDINFO" SP "(" list-select-base-opt-quoted *(SP list-select-base-opt-quoted) ")"
child-mbox-flag = "\HasChildren" / "\HasNoChildren"
; Attributes for CHILDREN return option, at most one possible per LIST response
; A tag for extended list data defined in a Standard Track or Experimental RFC.
eitem-standard-tag = atom
; A vendor-specific tag for extended list data
eitem-vendor-tag = vendor-token "-" atom
list = "LIST" [SP list-select-opts] SP mailbox SP mbox-or-pat [SP list-return-opts]
; List return options, e.g., CHILDREN
list-return-opts = "RETURN" SP "(" [return-option *(SP return-option)] ")"
; Options that can be used by themselves
list-select-base-opt = "SUBSCRIBED" / option-extension
list-select-base-opt-quoted = DQUOTE list-select-base-opt DQUOTE
; Options that do not syntactically interact with other options
list-select-independent-opt = "REMOTE" / option-extension
; Options that require a list-select-base-opt to also be present
list-select-mod-opt = "RECURSIVEMATCH" / option-extension
; An option registration template is described in Section 9.3 of this document.
list-select-opt = list-select-base-opt / list-select-independent-opt / list-select-mod-opt
; Any number of options may be in any order.
; If a list-select-mod-opt appears, then a list-select-base-opt must also appear.
; This allows these:
; ()
; (REMOTE)
; (SUBSCRIBED)
; (SUBSCRIBED REMOTE)
; (SUBSCRIBED RECURSIVEMATCH)
; (SUBSCRIBED REMOTE RECURSIVEMATCH)
; But does NOT allow these:
; (RECURSIVEMATCH)
; (REMOTE RECURSIVEMATCH)
list-select-opts = "(" [ (*(list-select-opt SP) list-select-base-opt *(SP list-select-opt)) / (list-select-independent-opt *(SP list-select-independent-opt)) ] ")"
; This is the list information pointed to by the ABNF item "mailbox-data", which is defined in [IMAP4]
mailbox-list = "(" [mbx-list-flags] ")" SP (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox [SP mbox-list-extended]
mbox-list-extended = "(" [mbox-list-extended-item *(SP mbox-list-extended-item)] ")"
mbox-list-extended-item = mbox-list-extended-item-tag SP tagged-ext-val
; The content MUST conform to either "eitem-vendor-tag" or "eitem-standard-tag" ABNF productions.
; A tag registration template is described in this document in Section 9.5.
mbox-list-extended-item-tag = astring
mbx-list-oflag =/ child-mbox-flag / "\Subscribed" / "\Remote"
mbx-list-sflag =/ "\NonExistent"
mbox-or-pat = list-mailbox / patterns
option-extension = (option-standard-tag / option-vendor-tag) [SP option-value]
; An option defined in a Standards Track or Experimental RFC.
option-standard-tag = atom
option-val-comp = astring / option-val-comp *(SP option-val-comp) / "(" option-val-comp ")"
option-value = "(" option-val-comp ")"
; A vendor-specific option, non-standard.
option-vendor-tag = vendor-token "-" atom
patterns = "(" list-mailbox *(SP list-mailbox) ")"
return-option = "SUBSCRIBED" / "CHILDREN" / option-extension
; Extensions that follow this general syntax should use nstring instead of astring when appropriate in the context of the extension.
; Note that a message set or a "number" can always be represented as an "atom".
; A URL should be represented as a "quoted" string.
tagged-ext-comp = astring / tagged-ext-comp *(SP tagged-ext-comp) / "(" tagged-ext-comp ")"
tagged-ext-simple = sequence-set / number
tagged-ext-val = tagged-ext-simple / "(" [tagged-ext-comp] ")"
See RFC5258.