mirror of
https://github.com/mjl-/mox.git
synced 2025-06-27 23:08:14 +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.
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package imapserver
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mjl-/mox/imapclient"
|
|
)
|
|
|
|
func TestUnsubscribe(t *testing.T) {
|
|
tc := start(t, false)
|
|
defer tc.close()
|
|
|
|
tc.login("mjl@mox.example", password0)
|
|
|
|
tc2 := startNoSwitchboard(t, false)
|
|
defer tc2.closeNoWait()
|
|
tc2.login("mjl@mox.example", password0)
|
|
|
|
tc.transactf("bad", "unsubscribe") // Missing param.
|
|
tc.transactf("bad", "unsubscribe ") // Missing param.
|
|
tc.transactf("bad", "unsubscribe fine ") // Leftover data.
|
|
|
|
tc.transactf("no", "unsubscribe a/b") // Does not exist and is not subscribed.
|
|
tc.transactf("ok", "unsubscribe expungebox") // Does not exist anymore but is still subscribed.
|
|
tc.transactf("no", "unsubscribe expungebox") // Not subscribed.
|
|
tc2.transactf("ok", "noop")
|
|
tc2.xuntagged(imapclient.UntaggedList{Flags: []string{`\NonExistent`}, Separator: '/', Mailbox: "expungebox"})
|
|
|
|
tc.transactf("ok", "create a/b")
|
|
tc2.transactf("ok", "noop")
|
|
tc.transactf("ok", "unsubscribe a/b")
|
|
tc.transactf("ok", "unsubscribe a/b") // Can unsubscribe even if there is no subscription.
|
|
tc2.transactf("ok", "noop")
|
|
tc2.xuntagged(imapclient.UntaggedList{Flags: []string(nil), Separator: '/', Mailbox: "a/b"})
|
|
|
|
tc.transactf("ok", "subscribe a/b")
|
|
tc.transactf("ok", "unsubscribe a/b")
|
|
}
|