MBOX-Line: From petite_abeille at mac.com  Sun Nov  6 13:51:16 2011
To: imap-protocol@u.washington.edu
From: Petite Abeille <petite_abeille@mac.com>
Date: Fri Jun  8 12:34:47 2018
Subject: [Imap-protocol] [noob] select & unseen?
In-Reply-To: <20111106213124.GA27889@brong.net>
References: <C61A1BDF-03DD-4ED9-BFCA-C6183F07DD3E@mac.com>
	<20111106213124.GA27889@brong.net>
Message-ID: <FC7BC111-BCF3-41CB-90E8-52980C306356@mac.com>


On Nov 6, 2011, at 10:31 PM, Bron Gondwana wrote:

> On Sun, Nov 06, 2011 at 09:15:34PM +0100, Petite Abeille wrote:
>> Given a mailbox containing only \Seen messages, what kind of UNSEEN response is SELECT supposed to return?
>> 
>> Looking at, say, dovecot implementation, it doesn't return any UNSEEN data if all messages are \Seen:
>> 
>> 	if (status.first_unseen_seq != 0) {
>> 		client_send_line(client,
>> 			t_strdup_printf("* OK [UNSEEN %u] First unseen.",
>> 					status.first_unseen_seq));
>> 	}
> 
> Cyrus does the same:
> 
>    if (state->firstnotseen)
> 	prot_printf(state->out, "* OK [UNSEEN %u] Ok\r\n",
> 		    state->firstnotseen);

Ok, that settles it I guess :)

> Ok - I think I've deciphered it.  You MUST NOT select mailboxes
> unless they have unseen messages in them.  Problem solved.

That's one way to look at it :P

One more minor clarification...

In the example above, both dovecot and cyrus suffix the response with a bit of free form text:

* OK [UNSEEN 123] First unseen. <- "First unseen."
* OK [UNSEEN 123] Ok <- "Ok" 

From the spec:

* OK [UNSEEN 12] Message 12 is first unseen <- "Message 12 is first unseen" 

Is that trailing text mandatory? It doesn't seem to add much of anything functional to the response. Can the response dispense with it?

* OK [UNSEEN 123]

Thanks.






