imapserver: only send OLDNAME in LIST responses when IMAP4rev2 was enabled

OLDNAME is included in IMAP4rev2, but not in IMAP4rev1. it is also included in
the NOTIFY extension, but we don't implement that yet.

found by Damian Poddebniak with https://github.com/duesee/imap-flow, thanks!
This commit is contained in:
Mechiel Lukkien
2023-12-14 20:09:13 +01:00
parent fbc18d522d
commit 41e3d1af10
3 changed files with 26 additions and 9 deletions

View File

@ -32,9 +32,15 @@ func TestRename(t *testing.T) {
tc.client.Subscribe("x/y/c") // For later rename, but not affected by rename of x.
tc2.transactf("ok", "noop") // Drain.
tc.transactf("ok", "rename x y")
tc.transactf("ok", "rename x z")
tc2.transactf("ok", "noop")
tc2.xuntagged(imapclient.UntaggedList{Separator: '/', Mailbox: "y", OldName: "x"})
tc2.xuntagged(imapclient.UntaggedList{Separator: '/', Mailbox: "z"})
// OldName is only set for IMAP4rev2 or NOTIFY.
tc2.client.Enable("IMAP4rev2")
tc.transactf("ok", "rename z y")
tc2.transactf("ok", "noop")
tc2.xuntagged(imapclient.UntaggedList{Separator: '/', Mailbox: "y", OldName: "z"})
// Rename to a mailbox that only exists in database as subscribed.
tc.transactf("ok", "rename y sub")