mirror of
https://github.com/mjl-/mox.git
synced 2025-07-19 03:26:37 +03:00
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:
39
imapserver/uidonly_test.go
Normal file
39
imapserver/uidonly_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
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")
|
||||
}
|
Reference in New Issue
Block a user