MBOX-Line: From tss at iki.fi  Sun Mar  4 03:49:49 2012
To: imap-protocol@u.washington.edu
From: Timo Sirainen <tss@iki.fi>
Date: Fri Jun  8 12:34:47 2018
Subject: [Imap-protocol] recent response in status command
In-Reply-To: <4F53524C.3000308@nfg.nl>
References: <4F53524C.3000308@nfg.nl>
Message-ID: <ACDE4DFC-35B3-4CD9-80F9-DD2AB711BBC4@iki.fi>

On 4.3.2012, at 13.30, Paul J Stevens wrote:

> One thing has me stumped in the 'append' test
> 
> # Two connections have mailbox SELECTed, one doesn't.
> # The \recent flags can be given to either one of the SELECTed
> connections,
> 
> # but never for the 3rd. We rely on mailbox state tracking to catch
> duplicate
> # \recent flags (which is why there are two FETCH FLAGS commands).
> 
> I don't understand why a status command on a 3rd session should be able
> to see the updated number of recent messages. The 3rd session selecting
> the mailbox and fetching the flags *before* one of the selected sessions
> fetch them seems perfectly valid to me.

I'm not entirely sure what you mean. Anyway, what the test is supposed to do is:

 - 1 and 2 connections have mailbox selected
 - 1 connection APPENDs a new message
 - most servers assign \recent flag to connection 1 before APPEND returns tagged OK
 - just in case some server might have assigned it to 2nd connection, the 2nd connection does a NOOP
 - now imaptest knows that the \recent must be in either connection 1 or connection 2 (both connections have informed the client with EXISTS that there are new messages, so the \recent flag must have been set)
 - (if there had been yet another EXAMINEd mailbox, I guess it could also show the message as \recent, but imaptest doesn't create such a connection)
 - any further connections that SELECT/EXAMINE/STATUS the mailbox won't see the message as \recent (by definition of how \recent works)
 - so the 3rd connection's STATUS should see updated message/unseen count, but recent count must be 0


