MBOX-Line: From mrc+imap at panda.com  Thu Dec  8 12:52:41 2011
To: imap-protocol@u.washington.edu
From: Mark Crispin <mrc+imap@panda.com>
Date: Fri Jun  8 12:34:47 2018
Subject: [Imap-protocol] [noob] notification of deleted/expunged messages?
In-Reply-To: <8A9E65D1-7495-41F8-9067-4E07D89C3192@mac.com>
References: <A891B744-87A2-42A5-9A02-81E212A9AB2E@mac.com>
	<80779123-5707-46B5-80E9-F90412A013BD@iki.fi>
	<1323259286.1981.140661008567313@webmail.messagingengine.com>
	<alpine.OSX.2.00.1112070846440.931@hsinghsing.panda.com>
	<8A9E65D1-7495-41F8-9067-4E07D89C3192@mac.com>
Message-ID: <alpine.OSX.2.00.1112081243101.931@hsinghsing.panda.com>

On Thu, 8 Dec 2011, Petite Abeille wrote:
> In my specific scenario, there are always, say, 1,000 sequences in the
> mailbox. It's just that what messages they represent varies over time.
> No messages are deleted per se. They just fail out of the "recent
> messages" window.

I assume that this is something in an IMAP server? That is, the server
always shows 1000 messages, but from time to time messages vanish in the
existing sequence space, and new messages take their place at the top of
the space?

> In any case, perhaps a simple setup is to freeze the message window upon
> mailbox selection, until a noop request comes along, at which point the
> appropriate expunge notification is communicated to the client and the
> new messages are published. That should guaranty fetch consistency until
> the server is in a position to communicate the message changes to the
> client, no?

If I understand what you are doing correctly, yes.

So, if the bottommost three messages vanish, and are replaced by three new
messages, the server sequence on the EXPUNGE-valid point will be:
 	* 1 EXPUNGE
 	* 1 EXPUNGE
 	* 1 EXPUNGE
 	* 1000 EXISTS

Remember that the EXPUNGE response has immediate effect on the sequence
space. If your server transmits:
 	* 1 EXPUNGE
 	* 2 EXPUNGE
 	* 3 EXPUNGE
that would remove original messages 1,3,5, not 1:3.

However, note that:
 	* 3 EXPUNGE
 	* 2 EXPUNGE
 	* 1 EXPUNGE
is exactly equivalent to:
 	* 1 EXPUNGE
 	* 1 EXPUNGE
 	* 1 EXPUNGE

If you understand why this is the case, then you can be confident that you
understand how sequence numbers work.

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.

