mirror of
https://github.com/mjl-/mox.git
synced 2025-07-19 03:26:37 +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:
@ -176,6 +176,29 @@ func (t listspace) writeTo(c *conn, w io.Writer) {
|
||||
fmt.Fprint(w, ")")
|
||||
}
|
||||
|
||||
// concatenate tokens space-separated
|
||||
type concatspace []token
|
||||
|
||||
func (t concatspace) pack(c *conn) string {
|
||||
var s string
|
||||
for i, e := range t {
|
||||
if i > 0 {
|
||||
s += " "
|
||||
}
|
||||
s += e.pack(c)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (t concatspace) writeTo(c *conn, w io.Writer) {
|
||||
for i, e := range t {
|
||||
if i > 0 {
|
||||
fmt.Fprint(w, " ")
|
||||
}
|
||||
e.writeTo(c, w)
|
||||
}
|
||||
}
|
||||
|
||||
// Concatenated tokens, no spaces or list syntax.
|
||||
type concat []token
|
||||
|
||||
@ -215,6 +238,21 @@ func (t astring) writeTo(c *conn, w io.Writer) {
|
||||
w.Write([]byte(t.pack(c)))
|
||||
}
|
||||
|
||||
// mailbox with utf7 encoding if connection requires it, or utf8 otherwise.
|
||||
type mailboxt string
|
||||
|
||||
func (t mailboxt) pack(c *conn) string {
|
||||
s := string(t)
|
||||
if !c.utf8strings() {
|
||||
s = utf7encode(s)
|
||||
}
|
||||
return astring(s).pack(c)
|
||||
}
|
||||
|
||||
func (t mailboxt) writeTo(c *conn, w io.Writer) {
|
||||
w.Write([]byte(t.pack(c)))
|
||||
}
|
||||
|
||||
type number uint32
|
||||
|
||||
func (t number) pack(c *conn) string {
|
||||
|
Reference in New Issue
Block a user