connector

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 9 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 {
	// 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()

	// 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 string) (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, mboxID string, newName []string) error

	// DeleteLabel deletes the label with the given ID.
	DeleteLabel(ctx context.Context, mboxID string) error

	GetMessage(ctx context.Context, messageID string) (imap.Message, []string, error)
	CreateMessage(ctx context.Context, mboxID string, literal []byte, flags imap.FlagSet, date time.Time) (imap.Message, error)
	LabelMessages(ctx context.Context, messageIDs []string, mboxID string) error
	UnlabelMessages(ctx context.Context, messageIDs []string, mboxID string) error
	MarkMessagesSeen(ctx context.Context, messageIDs []string, seen bool) error
	MarkMessagesFlagged(ctx context.Context, messageIDs []string, flagged bool) error

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

func (*Dummy) Close

func (conn *Dummy) Close() 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 string, literal []byte, flags imap.FlagSet, date time.Time) (imap.Message, error)

func (*Dummy) DeleteLabel

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

func (*Dummy) Flush

func (conn *Dummy) Flush()

func (*Dummy) GetLabel

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

func (*Dummy) GetMessage

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

func (*Dummy) GetUpdates

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

func (*Dummy) LabelMessages

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

func (*Dummy) MailboxCreated

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

func (*Dummy) MailboxDeleted

func (conn *Dummy) MailboxDeleted(labelID string) error

func (*Dummy) MarkMessagesFlagged

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

func (*Dummy) MarkMessagesSeen

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

func (*Dummy) MessageAdded

func (conn *Dummy) MessageAdded(messageID, labelID string) error

func (*Dummy) MessageCreated

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

func (*Dummy) MessageFlagged

func (conn *Dummy) MessageFlagged(messageID string, flagged bool) error

func (*Dummy) MessageRemoved

func (conn *Dummy) MessageRemoved(messageID, labelID string) error

func (*Dummy) MessageSeen

func (conn *Dummy) MessageSeen(messageID string, 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 []string, mboxID string) error

func (*Dummy) UpdateLabel

func (conn *Dummy) UpdateLabel(ctx context.Context, labelID string, 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