MBOX-Line: From gds at chartertn.net  Sun Oct  8 13:58:53 2017
To: imap-protocol@u.washington.edu
From: Gene Smith <gds@chartertn.net>
Date: Fri Jun  8 12:34:55 2018
Subject: [Imap-protocol] Is server re-use of UID OK?
Message-ID: <38137c2b-f1f1-2bed-e22f-2aea7fa50ac3@chartertn.net>

Copy a message with UID 1267 from Inbox to Mbox and deleted it in Inbox. 
With Inbox selected:

C: aaa UID COPY 1267 "Mbox"
S: aaa OK [COPYUID 123456789 1267 1007] UID COPY completed
C: bbb UID store 1267 +Flags (\Deleted)
:

This works fine and message appears gone from Inbox and is now visible 
in Mbox at UID 1007. Now with Mbox selected, attempt to copy the message 
UID 1007 back to Inbox:

C: ccc UID COPY 1007 "Inbox"
S: ccc OK [COPYUID 987654321 1007 1267] UID COPY completed
C: ddd UID store 1007 +Flags (\Deleted)
:

This occurs with no error and the message appears gone from Mbox. 
However, it does not appear in Inbox. The problem is that the server 
doesn't use the UIDNEXT of Inbox, which is 1270. Instead it reuses and 
copies to the UID that the message originally had in Inbox, 1267. Also, 
the \deleted flag on 1267 remains set and does not get cleared after the 
copy, causing the message to remain not visible in Inbox.

Does this seem like acceptable imap server behavior?

Note: If Inbox is expunged before the message is copied back, the server 
copies to Inbox's UIDNEXT (1270) and the the message appears correctly 
in Inbox with \delete flag cleared.

Thanks,

-gene









