managesieve

package
v0.0.0-...-835d0ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureCRLF

func EnsureCRLF(data []byte) []byte

Types

type Capabilities

type Capabilities struct {
	Implementation string   `managesieve:"IMPLEMENTATION"` // MUST be present
	SASL           []string `managesieve:"SASL"`           //
	Sieve          []string `managesieve:"SIEVE"`          // MUST be present
	StartTLS       bool     `managesieve:"STARTTLS"`       //
	MaxRedirects   int      `managesieve:"MAXREDIRECTS"`   // may be missing; 0 = no limit
	Notify         []string `managesieve:"NOTIFY"`         // may be empty if the server does not support enotify
	Language       string   `managesieve:"LANGUAGE"`       // RFC4656; empty = i-default (RFC2277)
	Owner          string   `managesieve:"OWNER"`          // may be present only when authenticated
	Version        string   `managesieve:"VERSION"`        // MUST be present
}

func ParseCapabilities

func ParseCapabilities(content []string) (capabilities *Capabilities, err error)

type Client

type Client interface {
	Close() error

	RawCmd(format string, args ...any) ([]string, string, error)

	Login(user, pass string) (string, error)
	StartTLS() (string, error)
	Logout() error
	Capability() (string, error)
	HaveSpace(name string, size int64) (string, error)
	ListScripts() ([]Script, string, error)
}

func NewClient

func NewClient(addr string, options ...Option) (Client, error)

type Command

type Command[T any] interface {
	Execute(*baseClient, ...any) (T, string, error)
}

type Logger

type Logger interface {
	SetOutput(w io.Writer)
	SetPrefix(string)

	Printf(string, ...any)
	Println(...any)
}

Logger represents the logger functionalities required by the client

type Option

type Option interface {
	Set(params *parameters) error
}

type OptionFn

type OptionFn func(params *parameters) error

func WithDialTimeout

func WithDialTimeout(t time.Duration) OptionFn

func WithLogger

func WithLogger(l Logger) OptionFn

func (OptionFn) Set

func (fn OptionFn) Set(params *parameters) error

type RawCommand

type RawCommand string

func (*RawCommand) Execute

func (cmd *RawCommand) Execute(client *baseClient, args ...any) ([]string, string, error)

type Response

type Response interface {
	Parse([]string) error
}

type Script

type Script struct {
	Name   string
	Active bool
}

type WireCommand

type WireCommand = string
const (
	Authenticate   WireCommand = `AUTHENTICATE`
	StartTLS       WireCommand = `STARTTLS`
	Logout         WireCommand = `LOGOUT`
	Capability     WireCommand = `CAPABILITY`
	HaveSpace      WireCommand = `HAVESPACE`
	PutScript      WireCommand = `PUTSCRIPT`
	ListScripts    WireCommand = `LISTSCRIPTS`
	SetActive      WireCommand = `SETACTIVE`
	GetScript      WireCommand = `GETSCRIPT`
	DeleteScript   WireCommand = `DELETESCRIPT`
	RenameScript   WireCommand = `RENAMESCRIPT`
	CheckScript    WireCommand = `CHECKSCRIPT`
	NoOp           WireCommand = `NOOP`
	Unauthenticate WireCommand = `UNAUTHENTICATE`
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL