This repository has been archived on 2023-12-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2022-12-16 19:45:01 -08:00

36 lines
849 B
Go

// 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
}