This commit is contained in:
Bel LaPointe
2021-12-10 07:19:31 -07:00
parent e6a71d692e
commit dad1b3042c
152 changed files with 21753 additions and 9433 deletions

View File

@@ -0,0 +1,35 @@
// IMAP responses defined in RFC 3501.
package responses
import (
"errors"
"github.com/emersion/go-imap"
)
// ErrUnhandled is used when a response hasn't been handled.
var ErrUnhandled = errors.New("imap: unhandled response")
var errNotEnoughFields = errors.New("imap: not enough fields in response")
// Handler handles responses.
type Handler interface {
// Handle processes a response. If the response cannot be processed,
// ErrUnhandledResp must be returned.
Handle(resp imap.Resp) error
}
// HandlerFunc is a function that handles responses.
type HandlerFunc func(resp imap.Resp) error
// Handle implements Handler.
func (f HandlerFunc) Handle(resp imap.Resp) error {
return f(resp)
}
// Replier is a Handler that needs to send raw data (for instance
// AUTHENTICATE).
type Replier interface {
Handler
Replies() <-chan []byte
}