mirror of
https://github.com/mjl-/mox.git
synced 2025-06-27 21:48:16 +03:00

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.
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package imapserver
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mjl-/mox/imapclient"
|
|
)
|
|
|
|
func TestLsub(t *testing.T) {
|
|
testLsub(t, false)
|
|
}
|
|
|
|
func TestLsubUIDOnly(t *testing.T) {
|
|
testLsub(t, true)
|
|
}
|
|
|
|
func testLsub(t *testing.T, uidonly bool) {
|
|
tc := start(t, uidonly)
|
|
defer tc.close()
|
|
|
|
tc.login("mjl@mox.example", password0)
|
|
|
|
tc.transactf("bad", "lsub") // Missing params.
|
|
tc.transactf("bad", `lsub ""`) // Missing param.
|
|
tc.transactf("bad", `lsub "" x `) // Leftover data.
|
|
|
|
tc.transactf("ok", `lsub "" x*`)
|
|
tc.xuntagged()
|
|
|
|
tc.transactf("ok", `lsub "" expungebox`)
|
|
tc.xuntagged(imapclient.UntaggedLsub{Separator: '/', Mailbox: "expungebox"})
|
|
|
|
tc.transactf("ok", "create a/b/c")
|
|
tc.transactf("ok", `lsub "" a/*`)
|
|
tc.xuntagged(imapclient.UntaggedLsub{Separator: '/', Mailbox: "a/b"}, imapclient.UntaggedLsub{Separator: '/', Mailbox: "a/b/c"})
|
|
|
|
// ../rfc/3501:2394
|
|
tc.transactf("ok", "unsubscribe a")
|
|
tc.transactf("ok", "unsubscribe a/b")
|
|
tc.transactf("ok", `lsub "" a/%%`)
|
|
tc.xuntagged(imapclient.UntaggedLsub{Flags: []string{`\NoSelect`}, Separator: '/', Mailbox: "a/b"})
|
|
|
|
tc.transactf("ok", "unsubscribe a/b/c")
|
|
tc.transactf("ok", `lsub "" a/%%`)
|
|
tc.xuntagged()
|
|
}
|