[sylpheed:32488] Re: Missing IMAP Subfolders

Michael Schwendt mschwendt at gmail.com
Wed Jul 9 18:24:25 JST 2008


On Wed, 9 Jul 2008 11:01:36 +0900, Hiroyuki Yamamoto wrote:

> You're correct. I have changed the implementation of IMAP folder scan
> to use 'LIST "" "*"' instead of 'LIST "" "%"' at 2.4.6.
> It seems to break compatibility with some IMAP servers.

Could also be a server implementation bug, however. The '*' wildcard
works fine here with dovecot and a few other service providers, such
as Google Mail.

The exact difference between '*' and '%' is not clear to me yet
as there are exceptions in how the server may interpret the wildcard.

In this example, I've changed the mailbox hierarchy separator to '.'
instead of '/'. The original folder path names can be seen in the
"folder '...' found" output. The root INBOX folder _and_ its sub-folders
are returned when using the '*' wildcard, and Sylpheed recognises
INBOX as root folder because it doesn't contain the '/':

[10:40:57] IMAP4> 4 LIST "" "*"
getting list of "" ...
IMAP4< * LIST (\HasNoChildren) "." "INBOX.Spam"
folder 'INBOX/Spam' found.
IMAP4< * LIST (\HasNoChildren) "." "INBOX.SentMail"
folder 'INBOX/SentMail' found.
IMAP4< * LIST (\HasNoChildren) "." "INBOX.Drafts"
folder 'INBOX/Drafts' found.
IMAP4< * LIST (\HasNoChildren) "." "INBOX.Trash"
folder 'INBOX/Trash' found.
IMAP4< * LIST (\Unmarked \HasChildren) "." "INBOX"
folder 'INBOX' found.
[10:40:57] IMAP4< 4 OK LIST completed
imap_get_part_folder_list(): get root folders
append 'INBOX'
imap_get_part_folder_list(): get folders under 'INBOX'
append 'INBOX/Spam'
append 'INBOX/SentMail'
append 'INBOX/Drafts'
append 'INBOX/Trash'

rfc3501 says:

      The character "*" is a wildcard, and matches zero or more
      characters at this position.  The character "%" is similar to "*",
      but it does not match a hierarchy delimiter.  If the "%" wildcard
      is the last character of a mailbox name argument, matching levels
      of hierarchy are also returned.  If these levels of hierarchy are
      not also selectable mailboxes, they are returned with the
      \Noselect mailbox name attribute (see the description of the LIST
      response for more details).

      Server implementations are permitted to "hide" otherwise
      accessible mailboxes from the wildcard characters, by preventing
      certain characters or names from matching a wildcard in certain
      situations.  For example, a UNIX-based server might restrict the
      interpretation of "*" so that an initial "/" character does not
      match.

Another sources says

      "*" is a wildcard which matches zero or more
      characters; "%" is a variant which does not descend a hierarchy level.
      Read the IMAP specification for more information.

and doesn't comment on what '%' as the last character of a mailbox
name should return. How many hierarchy levels would it descend?

Then:

   "*" and "%" wildcard characters can be used in either specifier to
   match one or more characters at that position, with the exception
   that "%" does not match the hierarchy delimiter for the specifier it
   appears in (i.e. "/" for an entry specifier or "." for an attribute
   specifier). Thus an entry specifier of "/%" would match entries such
   as "/comment" and "/version", but not "/comment/note".

Here, how would one match "/folder/foo/bar"? What is '%' in a root LIST
supposed to return?


More information about the Sylpheed mailing list