mirror of
https://github.com/mjl-/mox.git
synced 2025-07-19 02:06:38 +03:00
implement IMAP CREATE-SPECIAL-USE extension for the mailbox create command, part of rfc 6154
we already supported special-use flags. settable through the webmail interface, and new accounts already got standard mailboxes with special-use flags predefined. but now the IMAP "CREATE" command implements creating mailboxes with special-use flags.
This commit is contained in:
@ -149,9 +149,18 @@ func (c *Conn) Examine(mailbox string) (untagged []Untagged, result Result, rerr
|
||||
}
|
||||
|
||||
// Create makes a new mailbox on the server.
|
||||
func (c *Conn) Create(mailbox string) (untagged []Untagged, result Result, rerr error) {
|
||||
// SpecialUse can only be used on servers that announced the CREATE-SPECIAL-USE
|
||||
// capability. Specify flags like \Archive, \Draft, \Junk, \Sent, \Trash, \All.
|
||||
func (c *Conn) Create(mailbox string, specialUse []string) (untagged []Untagged, result Result, rerr error) {
|
||||
defer c.recover(&rerr)
|
||||
return c.Transactf("create %s", astring(mailbox))
|
||||
if _, ok := c.CapAvailable[CapCreateSpecialUse]; !ok && len(specialUse) > 0 {
|
||||
c.xerrorf("server does not implement create-special-use extension")
|
||||
}
|
||||
var useStr string
|
||||
if len(specialUse) > 0 {
|
||||
useStr = fmt.Sprintf(" USE (%s)", strings.Join(specialUse, " "))
|
||||
}
|
||||
return c.Transactf("create %s%s", astring(mailbox), useStr)
|
||||
}
|
||||
|
||||
// Delete removes an entire mailbox and its messages.
|
||||
|
Reference in New Issue
Block a user