Subject: IMAP STATUS unseen and deleted

From: Ere Maijala <[email-masked]>
Date: Sat, 10 Jan 2004 20:24:39 +0200

Hello,

I'm a Mozilla (http://www.mozilla.org/) developer. Quite recently the 
Mozilla Mail IMAP client was changed to use STATUS when checking for new 
mail. After the change I started seeing spurious new mail notifications 
for some folders. While debugging the problem I logged the conversation 
between the client and the server and noticed that the IMAP server was 
counting deleted unseen messages as unseen in the status response. 
Although the messages are technically unseen, I don't find it practical 
to report them as such as the clients might not show those messages at 
all (they're just sitting the waiting for expunge). In this case Mozilla 
showed that there were some unread messages, but when the folder was 
opened the number was re-adjusted to zero. I believe I've seen the 
problem with Outlook Express too.

Here is a patch against imap-2002d. It works for me, but I've only 
changed unix version of the osdep files. Any comments?

Regards,

Ere Maijala
-- 
------------------------------------------------------------------
 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: Sat, 10 Jan 2004 11:27:50 -0800 (PST)

Since you asked for comments, my comment is that the IMAP server is
working correctly as-is, according to the IMAP specification.  I
understand the problem that you're trying to solve, but I don't think that
you'll have much luck solving it by changing the IMAP server.

It's probably much too late now to change the IMAP specification to
require that the UNSEEN count from STATUS disregard deleted messages.
Had that idea been brought up 8 years ago when STATUS first appeared, it
probably would have been accepted and made part of the specification.

There are now many IMAP server implementations.  I don't think that it is
feasible to change STATUS now.

By the way, I hope that Mozilla is not doing STATUS on a selected mailbox.
It is alright (and intended) to use STATUS to probe a non-selected
mailbox.  If the mailbox is selected there are other ways that should be
used by the client to check for new mail.

-- Mark --

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

---

From: Ere Maijala <[email-masked]>
Date: Sun, 11 Jan 2004 00:28:05 +0200

I stand corrected. I forgot to attach the patch, but maybe that was for 
the best. I've had some trouble adjusting my thinking to the fact that 
the deleted flag is just a flag and the messages are still there. That's 
why I read the RFC and thought it would be ok to return only the count 
of undeleted messages.

Would have been nice to have a status data item for both undeleted 
unseen and deleted unseen messages, but I understand the history and 
current situation. Now, is EXAMINE + SEARCH the best way to get the 
number of unseen undeleted messages without selecting the mailbox?

I haven't written the IMAP code of Mozilla, but I as far as I remember, 
it doesn't use status when a mailbox is selected, but NOOP and the 
status responses instead.

Thanks,

Ere

---

From: Mark Crispin <[email-masked]>
Date: Sat, 10 Jan 2004 19:57:06 -0800 (PST)

On Sun, 11 Jan 2004, Ere Maijala wrote:
> Now, is EXAMINE + SEARCH the best way to get the number of unseen undeleted
> messages without selecting the mailbox?

EXAMINE is a type of SELECT; the main advantage is that it does not impact
\Recent flags.  You are correct though in believing that EXAMINE+SEARCH is
the only way to get the number of unseen undeleted messages.

-- Mark --