MBOX-Line: From arnt at gulbrandsen.priv.no  Wed Sep  7 07:09:56 2005
To: imap-protocol@u.washington.edu
From: Arnt Gulbrandsen <arnt@gulbrandsen.priv.no>
Date: Fri Jun  8 12:34:36 2018
Subject: [Imap-protocol] SELECT of same mailbox
Message-ID: <UsPqTMxta5Q38J/4ek2JBA.md5@bluegrass.trish.de>

Hi,

I have a situation where SELECT is issued twice for the same mailbox. 
The second SELECT is superfluous. But does it end the session and start 
a new one?

In RFC I see text to support both possibilities. On page 33:

       The SELECT command automatically deselects any
       currently selected mailbox before attempting the new selection.
       Consequently, if a mailbox is selected and a SELECT command that
       fails is attempted, no mailbox is selected.

By that description, messages that were \recent before the second SELECT 
no longer are, and any outstanding EXPUNGE messages can be forgotten. 
But on page 5 I also see this, which implies that a SELECT of the same 
mailbox does not clear any \recent flags, and that the server cannot 
forget any outstnading EXPUNGEs:

    "Session" refers to the sequence of client/server interaction from
    the time that a mailbox is selected (SELECT or EXAMINE command) until
    the time that selection ends (SELECT or EXAMINE of another mailbox,
    CLOSE command, or connection termination).

Opinions?

My (strong) preference is that SELECT of a valid mailbox should start a 
new session, no matter whether it's the same mailbox as the previous 
one.

Arnt

