i18nlevel

package module
v0.0.0-...-d6ec885 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: MIT Imports: 5 Imported by: 0

README

go-imap-i18nlevel

GoDoc

I18NLEVEL extension for go-imap.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedBackend = errors.New("i18nlevel: backend not supported")
)

Functions

func NewExtension

func NewExtension() server.Extension

Types

type Backend

type Backend interface {
	// I18NLevel returns the internationalization level supported by backend.
	//
	// See RFC 5255 4.2, 4.3 and 4.6 sections for requirements of each level.
	//
	// If this method returns 1, the User objects do not have to implement the
	// User interface.
	I18NLevel() int
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c *client.Client) *Client

func (*Client) ActiveComparator

func (c *Client) ActiveComparator() (string, error)

ActiveComparator returns the active comparator used.

This command is valid only if I18NLevel() returns 2. See RFC 5255 for details.

func (*Client) I18NLevel

func (c *Client) I18NLevel() (int, error)

I18NLevel returns the internationalization level supported by the server.

If server does not support the I18NLEVEL extension, 0 is returned.

func (*Client) UseComparator

func (c *Client) UseComparator(cmps []string) (string, []string, error)

ActiveComparator changes the active comparator to the first comparator listed in cmps and supported by the server.

This command is valid only if I18NLevel() returns 2. See RFC 5255 for details.

type ComparatorCmd

type ComparatorCmd struct {
	Comparators []string
}

The COMPARATOR command. See RFC 5255 Section 4.7.

func (*ComparatorCmd) Command

func (cmd *ComparatorCmd) Command() *imap.Command

func (*ComparatorCmd) Parse

func (cmd *ComparatorCmd) Parse(fields []interface{}) error

type ComparatorHandler

type ComparatorHandler struct {
	ComparatorCmd
}

func (*ComparatorHandler) Handle

func (h *ComparatorHandler) Handle(conn server.Conn) error

type Comparators

type Comparators struct {
	Active  string
	Matched []string
}

The COMPARATORS response. See RFC 5255 Section 4.8.

func (*Comparators) Format

func (rs *Comparators) Format() (fields []interface{})

func (*Comparators) Handle

func (rs *Comparators) Handle(resp imap.Resp) error

func (*Comparators) Parse

func (rs *Comparators) Parse(fields []interface{}) error

func (*Comparators) WriteTo

func (rs *Comparators) WriteTo(w *imap.Writer) error

type User

type User interface {
	// UseComparator changes active comparator for the session.
	//
	// cmps is a non-empty list of comparators client wishes to use in the
	// preference order. The backend selects the first supported comparator and
	// changes the active session comparator to it. The return value contains
	// the identifier of selected comparator. And a list of  comparators which
	// matches any of the arguments to the COMPARATOR command and is present
	// only if more than one match is found.
	//
	// Special value "default" refers to the comparator that is used when no
	// UseComparator is called. Note that with I18NLevel() == 2, the default
	// comparator SHOULD be "i;unicode-casemap".
	UseComparator(cmps []string) (string, []string, error)

	// ActiveComparator returns the currently active comparator for the
	// session.
	ActiveComparator() string
}

Jump to

Keyboard shortcuts

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