mirror of
https://github.com/mjl-/mox.git
synced 2025-07-15 13:24:38 +03:00
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:
@ -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})
|
||||
|
||||
|
@ -37,6 +37,7 @@ const (
|
||||
CapSaveDate Capability = "SAVEDATE" // ../rfc/8514
|
||||
CapCreateSpecialUse Capability = "CREATE-SPECIAL-USE" // ../rfc/6154:296
|
||||
CapCompressDeflate Capability = "COMPRESS=DEFLATE" // ../rfc/4978:65
|
||||
CapListMetadata Capability = "LIST-METADTA" // ../rfc/9590:73
|
||||
)
|
||||
|
||||
// Status is the tagged final result of a command.
|
||||
@ -242,8 +243,10 @@ type UntaggedMetadataKeys struct {
|
||||
Keys []string
|
||||
}
|
||||
|
||||
// Annotation is a metadata server of mailbox annotation.
|
||||
type Annotation struct {
|
||||
Key string
|
||||
// Nil is represented by IsString false and a nil Value.
|
||||
IsString bool
|
||||
Value []byte
|
||||
}
|
||||
|
Reference in New Issue
Block a user