imapserver: implement UIDONLY extension, RFC 9586

Once clients enable this extension, commands can no longer refer to "message
sequence numbers" (MSNs), but can only refer to messages with UIDs. This means
both sides no longer have to carefully keep their sequence numbers in sync
(error-prone), and don't have to keep track of a mapping of sequence numbers to
UIDs (saves resources).

With UIDONLY enabled, all FETCH responses are replaced with UIDFETCH response.
This commit is contained in:
Mechiel Lukkien
2025-04-11 11:45:49 +02:00
parent 8bab38eac4
commit 507ca73b96
41 changed files with 2405 additions and 1545 deletions

View File

@ -7,10 +7,18 @@ import (
)
func TestUnselect(t *testing.T) {
tc := start(t)
testUnselect(t, false)
}
func TestUnselectUIDOnly(t *testing.T) {
testUnselect(t, true)
}
func testUnselect(t *testing.T, uidonly bool) {
tc := start(t, uidonly)
defer tc.close()
tc.client.Login("mjl@mox.example", password0)
tc.login("mjl@mox.example", password0)
tc.client.Select("inbox")
tc.transactf("bad", "unselect bogus") // Leftover data.
@ -19,7 +27,7 @@ func TestUnselect(t *testing.T) {
tc.client.Select("inbox")
tc.client.Append("inbox", makeAppend(exampleMsg))
tc.client.StoreFlagsAdd("1", true, `\Deleted`)
tc.client.UIDStoreFlagsAdd("1", true, `\Deleted`)
tc.transactf("ok", "unselect")
tc.transactf("ok", "status inbox (messages)")
tc.xuntagged(imapclient.UntaggedStatus{Mailbox: "Inbox", Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 1}}) // Message not removed.