mox/imapserver/uidonly_test.go
Mechiel Lukkien 507ca73b96
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.
2025-04-11 11:45:49 +02:00

40 lines
976 B
Go

package imapserver
import (
"testing"
)
func TestUIDOnly(t *testing.T) {
tc := start(t, true)
defer tc.close()
tc.login("mjl@mox.example", password0)
tc.client.Select("inbox")
tc.transactf("bad", "Fetch 1")
tc.xcode("UIDREQUIRED")
tc.transactf("bad", "Fetch 1")
tc.xcode("UIDREQUIRED")
tc.transactf("bad", "Search 1")
tc.xcode("UIDREQUIRED")
tc.transactf("bad", "Store 1 Flags ()")
tc.xcode("UIDREQUIRED")
tc.transactf("bad", "Copy 1 Archive")
tc.xcode("UIDREQUIRED")
tc.transactf("bad", "Move 1 Archive")
tc.xcode("UIDREQUIRED")
// Sequence numbers in search program.
tc.transactf("bad", "Uid Search 1")
tc.xcode("UIDREQUIRED")
// Sequence number in last qresync parameter.
tc.transactf("ok", "Enable Qresync")
tc.transactf("bad", "Select inbox (Qresync (1 5 (1,3,6 1,3,6)))")
tc.xcode("UIDREQUIRED")
tc.client.Select("inbox") // Select again.
// Breaks connection.
tc.transactf("bad", "replace 1 inbox {1+}\r\nx")
tc.xcode("UIDREQUIRED")
}