You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aerc/worker/jmap/state.go

30 lines
567 B
Go

package jmap
import (
"git.sr.ht/~rockorager/go-jmap"
"git.sr.ht/~rockorager/go-jmap/mail/mailbox"
)
func (w *JMAPWorker) getMailboxState() (string, error) {
var req jmap.Request
req.Invoke(&mailbox.Get{Account: w.AccountId(), IDs: make([]jmap.ID, 0)})
resp, err := w.Do(&req)
if err != nil {
return "", err
}
for _, inv := range resp.Responses {
switch r := inv.Args.(type) {
case *mailbox.GetResponse:
return r.State, nil
case *jmap.MethodError:
return "", wrapMethodError(r)
}
}
// This should be an impossibility
return "", nil
}