fix the Status command on imapclient.Conn

it needs at least 1 attribute.
also make types for those attributes, so its harder to get them wrong.
nothing was using this function.
This commit is contained in:
Mechiel Lukkien
2024-03-11 15:22:41 +01:00
parent 4dea2de343
commit bcf737cbec
9 changed files with 83 additions and 26 deletions

View File

@ -206,10 +206,15 @@ func (c *Conn) Namespace() (untagged []Untagged, result Result, rerr error) {
return c.Transactf("namespace")
}
// Status requests information about a mailbox, such as number of messages, size, etc.
func (c *Conn) Status(mailbox string) (untagged []Untagged, result Result, rerr error) {
// Status requests information about a mailbox, such as number of messages, size,
// etc. At least one attribute required.
func (c *Conn) Status(mailbox string, attrs ...StatusAttr) (untagged []Untagged, result Result, rerr error) {
defer c.recover(&rerr)
return c.Transactf("status %s", astring(mailbox))
l := make([]string, len(attrs))
for i, a := range attrs {
l[i] = string(a)
}
return c.Transactf("status %s (%s)", astring(mailbox), strings.Join(l, " "))
}
// Append adds message to mailbox with flags and optional receive time.