mail

package
v0.0.0-...-a53e0fd Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SyncMessages

func SyncMessages(
	log logging.I,
	conn RemoteConnection,
	msgr MessageRepo,
	mb Mailbox,
) error

Types

type Account

type Account struct {
	UUID               kvs.UUID
	Username, Password string
}

type AccountRepo

type AccountRepo interface {
	Save(user Account) error
	Close()
}

func NewAccountRepo

func NewAccountRepo(db kvs.DB) AccountRepo

type ClientConnector

type ClientConnector func(useSSL bool) (RemoteConnection, error)

func ResolveClientConnector

func ResolveClientConnector(addr string, acc Account) ClientConnector

type Mailbox

type Mailbox struct {
	UUID kvs.UUID // our local unique identifier
	Name string   // the local visual rep and remote identifier
}

type MailboxRepo

type MailboxRepo interface {
	DumpTo(w io.Writer) error
	Save(owner kvs.UUID, mailbox Mailbox) error
	FetchByOwner(owner kvs.UUID) ([]Mailbox, error)
	Close()
}

func NewMailboxRepo

func NewMailboxRepo(db kvs.DB) MailboxRepo

type Message

type Message struct {
	UUID      kvs.UUID
	RemoteUID uint32
}

type MessageRepo

type MessageRepo interface {
	DumpTo(w io.Writer) error
	Save(owner kvs.UUID, msg Message) error
	FetchByOwner(owner kvs.UUID) ([]Message, error)
	Close() error
}

func NewMessageRepo

func NewMessageRepo(db kvs.DB) MessageRepo

type RemoteConnection

type RemoteConnection interface {
	RemoteMailboxLister
	RemoteMessagesFetcher
	Close() error
}

func RegisterAccount

func RegisterAccount(
	log logging.I,
	addr string,
	accRepo AccountRepo,
	mbRepo MailboxRepo,
	acc *Account,
	connect ClientConnector,
) (RemoteConnection, error)

type RemoteMailboxLister

type RemoteMailboxLister interface {
	List(ref, name string, ch chan *imap.MailboxInfo) error
}

type RemoteMessagesFetcher

type RemoteMessagesFetcher interface {
	Select(name string, readOnly bool) (*imap.MailboxStatus, error)
	Fetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error
}

Jump to

Keyboard shortcuts

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