connector

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package connector defines the type that connects the server to a remote.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchLabel   = errors.New("no such label")
	ErrNoSuchMessage = errors.New("no such message")

	ErrInvalidPrefix   = errors.New("invalid prefix")
	ErrRenameForbidden = errors.New("rename operation is not allowed")
	ErrDeleteForbidden = errors.New("delete operation is not allowed")
)

Functions

This section is empty.

Types

type Connector

type Connector interface {
	// Authorize returns whether the given username/password combination are valid for this connector.
	Authorize(username string, password []byte) bool

	// GetLabel returns information about the label with the given ID.
	GetLabel(ctx context.Context, labelID imap.LabelID) (imap.Mailbox, error)

	// CreateLabel creates a label with the given name.
	CreateLabel(ctx context.Context, name []string) (imap.Mailbox, error)

	// UpdateLabel sets the name of the label with the given ID.
	UpdateLabel(ctx context.Context, labelID imap.LabelID, newName []string) error

	// DeleteLabel deletes the label with the given ID.
	DeleteLabel(ctx context.Context, labelID imap.LabelID) error

	// GetMessage returns the message with the given ID.
	GetMessage(ctx context.Context, messageID imap.MessageID) (imap.Message, []imap.LabelID, error)

	// CreateMessage creates a new message on the remote.
	CreateMessage(ctx context.Context, labelID imap.LabelID, literal []byte, flags imap.FlagSet, date time.Time) (imap.Message, []byte, error)

	// LabelMessages labels the given messages with the given label ID.
	LabelMessages(ctx context.Context, messageIDs []imap.MessageID, labelID imap.LabelID) error

	// UnlabelMessages unlabels the given messages with the given label ID.
	UnlabelMessages(ctx context.Context, messageIDs []imap.MessageID, labelID imap.LabelID) error

	// MoveMessages removes the given messages from one label and adds them to the other label.
	MoveMessages(ctx context.Context, messageIDs []imap.MessageID, labelFromID, labelToID imap.LabelID) error

	// MarkMessagesSeen sets the seen value of the given messages.
	MarkMessagesSeen(ctx context.Context, messageIDs []imap.MessageID, seen bool) error

	// MarkMessagesFlagged sets the flagged value of the given messages.
	MarkMessagesFlagged(ctx context.Context, messageIDs []imap.MessageID, flagged bool) error

	// GetUpdates returns a stream of updates that the gluon server should apply.
	GetUpdates() <-chan imap.Update

	// GetUIDValidity returns the default UID validity for this user.
	GetUIDValidity() imap.UID

	// SetUIDValidity sets the default UID validity for this user.
	SetUIDValidity(uidValidity imap.UID) error

	// Close the connector will no longer be used and all resources should be closed/released.
	Close(ctx context.Context) error
}

Connector connects the gluon server to a remote mail store.

type Dummy

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

func NewDummy

func NewDummy(usernames []string, password []byte, period time.Duration, flags, permFlags, attrs imap.FlagSet) *Dummy

func (*Dummy) Authorize added in v0.3.0

func (conn *Dummy) Authorize(username string, password []byte) bool

func (*Dummy) ClearUpdates added in v0.9.0

func (conn *Dummy) ClearUpdates()

func (*Dummy) Close

func (conn *Dummy) Close(ctx context.Context) error

func (*Dummy) CreateLabel

func (conn *Dummy) CreateLabel(ctx context.Context, name []string) (imap.Mailbox, error)

func (*Dummy) CreateMessage

func (conn *Dummy) CreateMessage(ctx context.Context, mboxID imap.LabelID, literal []byte, flags imap.FlagSet, date time.Time) (imap.Message, []byte, error)

func (*Dummy) DeleteLabel

func (conn *Dummy) DeleteLabel(ctx context.Context, labelID imap.LabelID) error

func (*Dummy) Flush

func (conn *Dummy) Flush()

func (*Dummy) GetLabel

func (conn *Dummy) GetLabel(ctx context.Context, labelID imap.LabelID) (imap.Mailbox, error)

func (*Dummy) GetLastRecordedIMAPID added in v0.8.0

func (conn *Dummy) GetLastRecordedIMAPID() imap.IMAPID

func (*Dummy) GetMessage

func (conn *Dummy) GetMessage(ctx context.Context, messageID imap.MessageID) (imap.Message, []imap.LabelID, error)

func (*Dummy) GetUIDValidity added in v0.12.0

func (conn *Dummy) GetUIDValidity() imap.UID

func (*Dummy) GetUpdates

func (conn *Dummy) GetUpdates() <-chan imap.Update

func (*Dummy) LabelMessages

func (conn *Dummy) LabelMessages(ctx context.Context, messageIDs []imap.MessageID, mboxID imap.LabelID) error

func (*Dummy) MailboxCreated

func (conn *Dummy) MailboxCreated(mbox imap.Mailbox) error

func (*Dummy) MailboxDeleted

func (conn *Dummy) MailboxDeleted(labelID imap.LabelID) error

func (*Dummy) MarkMessagesFlagged

func (conn *Dummy) MarkMessagesFlagged(ctx context.Context, messageIDs []imap.MessageID, flagged bool) error

func (*Dummy) MarkMessagesSeen

func (conn *Dummy) MarkMessagesSeen(ctx context.Context, messageIDs []imap.MessageID, seen bool) error

func (*Dummy) MessageAdded

func (conn *Dummy) MessageAdded(messageID imap.MessageID, labelID imap.LabelID) error

func (*Dummy) MessageCreated

func (conn *Dummy) MessageCreated(message imap.Message, literal []byte, mboxIDs []imap.LabelID) error

func (*Dummy) MessageDeleted added in v0.8.1

func (conn *Dummy) MessageDeleted(messageID imap.MessageID) error

func (*Dummy) MessageFlagged

func (conn *Dummy) MessageFlagged(messageID imap.MessageID, flagged bool) error

func (*Dummy) MessageRemoved

func (conn *Dummy) MessageRemoved(messageID imap.MessageID, labelID imap.LabelID) error

func (*Dummy) MessageSeen

func (conn *Dummy) MessageSeen(messageID imap.MessageID, seen bool) error

func (*Dummy) MessagesCreated added in v0.12.0

func (conn *Dummy) MessagesCreated(messages []imap.Message, literals [][]byte, mboxIDs [][]imap.LabelID) error

func (*Dummy) MoveMessages added in v0.12.0

func (conn *Dummy) MoveMessages(ctx context.Context, messageIDs []imap.MessageID, labelFromID, labelToID imap.LabelID) error

func (*Dummy) SetFolderPrefix

func (conn *Dummy) SetFolderPrefix(pfx string)

func (*Dummy) SetLabelPrefix

func (conn *Dummy) SetLabelPrefix(pfx string)

func (*Dummy) SetUIDValidity added in v0.12.0

func (conn *Dummy) SetUIDValidity(imap.UID) error

func (*Dummy) Sync

func (conn *Dummy) Sync(ctx context.Context) error

func (*Dummy) UnlabelMessages

func (conn *Dummy) UnlabelMessages(ctx context.Context, messageIDs []imap.MessageID, mboxID imap.LabelID) error

func (*Dummy) UpdateLabel

func (conn *Dummy) UpdateLabel(ctx context.Context, labelID imap.LabelID, newName []string) error

Directories

Path Synopsis
Package mock_connector is a generated GoMock package.
Package mock_connector is a generated GoMock package.

Jump to

Keyboard shortcuts

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