connector

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 10 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 (
	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, password string) bool

	// ValidateCreate checks whether a mailbox with the given name can be created.
	// If so, the flags, permanent flags and attributes which the mailbox would have are returned.
	ValidateCreate(name []string) (flags, permFlags, attrs imap.FlagSet, err error)

	// ValidateUpdate checks whether a mailbox's name can be changed from oldName to newName.
	ValidateUpdate(oldName, newName []string) error

	// ValidateDelete checks whether the mailbox with the given name can be deleted.
	ValidateDelete(name []string) error

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

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

	// Pause pauses the stream of updates.
	Pause()

	// Resume resumes the stream of updates.
	Resume()

	// 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 string, period time.Duration, flags, permFlags, attrs imap.FlagSet) *Dummy

func (*Dummy) Authorize added in v0.3.0

func (conn *Dummy) Authorize(username, password string) 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, 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.ID

func (*Dummy) GetMessage

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

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) Pause

func (conn *Dummy) Pause()

func (*Dummy) Resume

func (conn *Dummy) Resume()

func (*Dummy) SetFolderPrefix

func (conn *Dummy) SetFolderPrefix(pfx string)

func (*Dummy) SetLabelPrefix

func (conn *Dummy) SetLabelPrefix(pfx string)

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, name []string) error

func (*Dummy) ValidateCreate

func (conn *Dummy) ValidateCreate(name []string) (imap.FlagSet, imap.FlagSet, imap.FlagSet, error)

func (*Dummy) ValidateDelete

func (conn *Dummy) ValidateDelete(name []string) error

func (*Dummy) ValidateUpdate

func (conn *Dummy) ValidateUpdate(oldName, 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