Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IMAP flag list with quotes

0 views
Skip to first unread message

Bill

unread,
Apr 27, 2005, 9:10:19 AM4/27/05
to
Are either of these flag values correct? Some servers work others fail.
The RFC is not clear on if the flags can have quotes around them or if there
can be spaces within them.

102 APPEND "Inbox" (\Seen "My Flag") "31-Mar-2005 05:33:48 -0500" {..}

102 APPEND "Inbox" (\Seen "MyFlag") "31-Mar-2005 05:33:48 -0500" {..}

--
Bill


Mark Crispin

unread,
Apr 27, 2005, 11:44:32 AM4/27/05
to
On Wed, 27 Apr 2005, Bill wrote:
> Are either of these flag values correct? Some servers work others fail.
> The RFC is not clear on if the flags can have quotes around them or if there
> can be spaces within them.

Actually, the RFC is quite explicit on the matter, but you have to know
where to look. In IMAP, as in other protocols, the Formal Syntax is where
the final say is to be found. Once you know how to read the ABNF, it's
quite easy to understand.

On page 86, we find that a flag is one of the following:
. one of a named list of flags starting with \
. a flag-extension, consisting of \ followed by an atom
. a flag-keyword, which is also an atom

An atom is defined on page 82. Briefly, it is an unquoted token that does
not contain one of the following characters:
( ) { % * " \ ]
space
control characters
characters with the high bit (8-bit characters)

Note that } and [ can be used in atoms!

What this all means is that

> 102 APPEND "Inbox" (\Seen "My Flag") "31-Mar-2005 05:33:48 -0500" {..}

is invalid. "My Flag" is a quoted string, not an atom, and hence can not
be used as a flag.

> 102 APPEND "Inbox" (\Seen "MyFlag") "31-Mar-2005 05:33:48 -0500" {..}

is also invalid, because "MyFlag" is also a quoted string.

You have to use:
102 APPEND "Inbox" (\Seen MyFlag) "31-Mar-2005 05:33:48 -0500" {..}
instead. MyFlag is an atom.

Note however, that a mailbox name can be either an atom or a string, and
thus:
102 APPEND Inbox (\Seen MyFlag) "31-Mar-2005 05:33:48 -0500" {..}
works equally well.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

Bill

unread,
Apr 27, 2005, 12:16:10 PM4/27/05
to
Thanks for the great explanation. That should also help me in the future.


"Mark Crispin" <m...@CAC.Washington.EDU> wrote in message
news:Pine.LNX.4.63.05...@shiva2.cac.washington.edu...

0 new messages