imapserver: implement rfc 9590, returning metadata in the extended list command

only with "return" including "metadata". so clients can quickly get certain
metadata (eg for display, such as a color) for mailboxes.

this also adds a protocol token type "mailboxt" that properly encodes to utf7
if required.
This commit is contained in:
Mechiel Lukkien
2025-02-23 22:12:18 +01:00
parent 2809136451
commit 0ed820e3b0
8 changed files with 120 additions and 24 deletions

View File

@ -460,11 +460,14 @@ func (c *Conn) xuntagged() Untagged {
var isString bool
if c.take('~') {
value = c.xliteral()
} else {
} else if c.peek('"') {
value = []byte(c.xstring())
isString = true
// note: the abnf also allows nstring, but that only makes sense when the
// production rule is used in the setmetadata command. ../rfc/5464:831
} else {
// For response to extended list.
c.xtake("nil")
}
r.Annotations = append(r.Annotations, Annotation{key, isString, value})