On Mon, 14 Jul 2003, Tim Showalter wrote:
> (1) The \Seen flag was changed by "FETCH [seq] (FLAGS BODY[]
> INTERNALDATE)" while the mailbox was being EXAMINEd. \Seen is not
> advertised in PERMANENTFLAGS in EXAMINE, but the change appears
> permanent.
>From RFC 3501, 6.3.2:
The EXAMINE command is identical to SELECT and returns the same
output; however, the selected mailbox is identified as read-only.
No changes to the permanent state of the mailbox, including
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
per-user state, are permitted; in particular, EXAMINE MUST NOT
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cause messages to lose the \Recent flag.
Also note the following text in 6.3.1:
[...] Read-only access
through SELECT differs from the EXAMINE command in that certain
read-only mailboxes MAY permit the change of permanent state on a
per-user (as opposed to global) basis. Netnews messages marked in
a server-based .newsrc file are an example of such per-user
permanent state that can be modified with read-only mailboxes.
Consequently: given that \Seen is not advertised in PERMANENTFLAGS in
EXAMINE, it is alright for \Seen to be changed by the FETCH since \Seen is
not a permanent flag.
It is *not* alright for that \Seen to take effect in other IMAP sessions,
whether concurrent or future.
> (2) "FETCH [seq] (FLAGS BODY[] FLAGS)" returns a FETCH response with the
> obvious three items in that order. The first FLAGS is (). The
> second flags is (\Seen).
This is alright, provided that \Seen is in fact a session-only flag.
> No implicit FLAGS response is returned in
> this case under either SELECT or EXAMINE.
This is also alright. There never was a requirement that FETCH data be
returned in the order given in the command; nor is there any prohibition
on consolidating FETCH data.
The only requirement is that all the FETCH data be returned.
As a result of the above, "FETCH seq (FLAGS BODY[] FLAGS)" is equivalent
to "FETCH seq BODY[]".
> (3) As an extra bonus, I'm not sure how to turn \Seen flags off. STORE
> [seq] -FLAGS (\Seen) seems like it ought to work, but it doesn't.
> Well, the server claims it does, but the flags are immediately
> re-set.
This would have sounded like like a mail store which is incapable of
accessing data without setting a \Seen flag, but...
> A workaround for the first two this is to BODY.PEEK[] even in EXAMINE
> mode, or to send FLAGS before BODY[]. Either would have worked around
> the bug, but only the former would have avoided changing \Seen.
So the mail store can return the data without setting the flag.
The first workaround is the only effective one. The second workaround can
only be trusted if you fetch the flags in a prior command.
> Potential workarounds for (3) are more drastic.
It sounds like the mail store is one with a "once set never cleared" \Seen
flag. I've heard of such mail stores; they aren't compliant with the
spirit of IMAP, but they are compliant with the letter. Put another way,
this is bad behavior but not prohibited behavior.
-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.