Subject: Expunge responses with multiple connection

From: Matteo Gelosa <[email-masked]>
Date: Mon, 07 Oct 2002 09:49:56 +0200

Hi all,
I have a question about synchronization between session cached message
list on the currently open mailbox and disk message list. I have wrote
a driver implementation that uses a database in place of canonical unix
file system to store message headers and file references. The problem
arises
when I have more than one open session on the same mailbox. Suppose we
have
client A and B.

A: logs-in and selects INBOX with 10 messages
B: does the same
A: set deleted flag on 1 message (sequence number) and expunge
B: fetch message 1 body (FETCH 1 ...)
    before the end of fetch, the <driver>_parse routine is called
    and (my own implementation) re-builds the internal message list
    with one less message. no expunge responses are sent back, but
    exists and recent messages are replied with the new number
    of messages.

B: fetch (again) message 1 body (FETCH 1 ...)
    the body is now different.

The question is: must the internal message list be re-built only within
command different from FETCH, STORE and SEARCH so that sequence numbers
still remain correct? If yes what should I do with the hole in message
list
at sequence number 1? How and when the server has to communicate to the
client that somebody else has removed one or more messages? Any
suggestion?

Thanks in advance,
Matteo Gelosa

PS
I have read the standard an looked at the unix.c implementation, but I
still have some doubts...

-- 
Matteo Gelosa                                             I.NET S.p.A.
Research & Development      Via Darwin, 85 - 20019 Settimo Milanese MI
mailto:[email-masked]                            Tel. +39.02.32863.1
http://www.inet.it                               Fax +39.02.32863.7701
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Mon, 7 Oct 2002 08:05:33 -0700 (PDT)

Until the server sends the untagged EXPUNGE, the message is NOT expunged in
that session.  Consequently, the server MUST NOT send an untagged EXISTS
response which reflects the action of an expunge before sending the untagged
EXPUNGE, and the server MUST respond to a FETCH of that message with the data
for that message.

This is an absolute requirement of the IMAP protocol specification.

As you noted, this could result in a "hole", in which a message has been
expunged but you can't announce it to the client yet, and the client might try
to fetch a message in the "hole".

Ideally, you should keep a "ghost" of the expunged message in each session
that is in this situation, and use the ghost to supply data to respond to any
fetch.  This is what most clients will expect.  RFC 2180 suggests some other
strategies, but they do not work as well.

The unix.c driver does not allow shared access, so the issue does not come up.
Look at how mbx.c works instead.