types

package
v0.0.0-...-1a3b2b2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkipThread = errors.New("skip this Thread")
View Source
var StrToStrategy = map[string]MultiFileStrategy{
	"refuse":              Refuse,
	"act-all":             ActAll,
	"act-one":             ActOne,
	"act-one-delete-rest": ActOneDelRest,
	"act-dir":             ActDir,
	"act-dir-delete-rest": ActDirDelRest,
}
View Source
var WorkerMessages = make(chan WorkerMessage, 50)

Functions

func SortThreadsBy

func SortThreadsBy(toSort []*Thread, sortBy []models.UID)

func StrategyStrs

func StrategyStrs() []string

Types

type AnsweredMessages

type AnsweredMessages struct {
	Message
	Answered bool
	Uids     []models.UID
}

type AppendMessage

type AppendMessage struct {
	Message
	Destination string
	Flags       models.Flags
	Date        time.Time
	Reader      io.Reader
	Length      int
}

type Backend

type Backend interface {
	Run()
	Capabilities() *models.Capabilities
	PathSeparator() string
}

type ByUID

type ByUID []*Thread

Implement interface to be able to sort threads by newest (max UID)

func (ByUID) Len

func (s ByUID) Len() int

func (ByUID) Less

func (s ByUID) Less(i, j int) bool

func (ByUID) Swap

func (s ByUID) Swap(i, j int)

type Cancelled

type Cancelled struct {
	Message
}

type CheckMail

type CheckMail struct {
	Message
	Directories []string
	Command     string
	Timeout     time.Duration
}

type CheckMailDirectories

type CheckMailDirectories struct {
	Message
	Directories []string
}

type Configure

type Configure struct {
	Message
	Config *config.AccountConfig
}

type ConnError

type ConnError struct {
	Message
	Error error
}

type Connect

type Connect struct {
	Message
}

type CopyMessages

type CopyMessages struct {
	Message
	Destination       string
	Uids              []models.UID
	MultiFileStrategy *MultiFileStrategy
}

type CreateDirectory

type CreateDirectory struct {
	Message
	Directory string
	Quiet     bool
}

type DeleteMessages

type DeleteMessages struct {
	Message
	Uids              []models.UID
	MultiFileStrategy *MultiFileStrategy
}

type Directory

type Directory struct {
	Message
	Dir *models.Directory
}

type DirectoryContents

type DirectoryContents struct {
	Message
	Uids []models.UID
}

type DirectoryInfo

type DirectoryInfo struct {
	Message
	Info    *models.DirectoryInfo
	Refetch bool
}

type DirectoryThreaded

type DirectoryThreaded struct {
	Message
	Threads []*Thread
}

type Disconnect

type Disconnect struct {
	Message
}

type Done

type Done struct {
	Message
}

type Error

type Error struct {
	Message
	Error error
}

type FetchDirectoryContents

type FetchDirectoryContents struct {
	Message
	Context      context.Context
	SortCriteria []*SortCriterion
	Filter       *SearchCriteria
}

type FetchDirectoryThreaded

type FetchDirectoryThreaded struct {
	Message
	Context       context.Context
	SortCriteria  []*SortCriterion
	Filter        *SearchCriteria
	ThreadContext bool
}

type FetchFullMessages

type FetchFullMessages struct {
	Message
	Uids []models.UID
}

type FetchMessageBodyPart

type FetchMessageBodyPart struct {
	Message
	Uid  models.UID
	Part []int
}

type FetchMessageFlags

type FetchMessageFlags struct {
	Message
	Context context.Context
	Uids    []models.UID
}

type FetchMessageHeaders

type FetchMessageHeaders struct {
	Message
	Context context.Context
	Uids    []models.UID
}

type FlagMessages

type FlagMessages struct {
	Message
	Enable bool
	Flags  models.Flags
	Uids   []models.UID
}

Flag messages with different mail types

type ForwardedMessages

type ForwardedMessages struct {
	Message
	Forwarded bool
	Uids      []models.UID
}

type FullMessage

type FullMessage struct {
	Message
	Content *models.FullMessage
}

type LabelList

type LabelList struct {
	Message
	Labels []string
}

type ListDirectories

type ListDirectories struct {
	Message
}

type Message

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

func RespondTo

func RespondTo(msg WorkerMessage) Message

func (*Message) Account

func (m *Message) Account() string

func (Message) InResponseTo

func (m Message) InResponseTo() WorkerMessage

type MessageBodyPart

type MessageBodyPart struct {
	Message
	Part *models.MessageBodyPart
}

type MessageInfo

type MessageInfo struct {
	Message
	Info       *models.MessageInfo
	NeedsFlags bool
}

type MessageWriter

type MessageWriter struct {
	Message
	Writer io.WriteCloser
}

type MessagesCopied

type MessagesCopied struct {
	Message
	Destination string
	Uids        []models.UID
}

type MessagesDeleted

type MessagesDeleted struct {
	Message
	Uids []models.UID
}

type MessagesMoved

type MessagesMoved struct {
	Message
	Destination string
	Uids        []models.UID
}

type ModifyLabels

type ModifyLabels struct {
	Message
	Uids   []models.UID
	Add    []string
	Remove []string
}

type MoveMessages

type MoveMessages struct {
	Message
	Destination       string
	Uids              []models.UID
	MultiFileStrategy *MultiFileStrategy
}

type MultiFileStrategy

type MultiFileStrategy uint

MultiFileStrategy represents a strategy for taking file-based actions (e.g., move, copy, delete) on messages that are represented by more than one file. These strategies are only used by the notmuch backend but are defined in this package to prevent import cycles.

const (
	Refuse MultiFileStrategy = iota
	ActAll
	ActOne
	ActOneDelRest
	ActDir
	ActDirDelRest
)

type NewThreadWalkFn

type NewThreadWalkFn func(t *Thread, level int, currentErr error) error

type OpenDirectory

type OpenDirectory struct {
	Message
	Context   context.Context
	Directory string
	Query     string
	Force     bool
}

type Reconnect

type Reconnect struct {
	Message
}

type RemoveDirectory

type RemoveDirectory struct {
	Message
	Directory string
	Quiet     bool
}

type SearchCriteria

type SearchCriteria struct {
	WithFlags    models.Flags
	WithoutFlags models.Flags
	From         []string
	To           []string
	Cc           []string
	Headers      textproto.MIMEHeader
	StartDate    time.Time
	EndDate      time.Time
	SearchBody   bool
	SearchAll    bool
	Terms        []string
	UseExtension bool
}

func (*SearchCriteria) Combine

func (c *SearchCriteria) Combine(other *SearchCriteria) *SearchCriteria

func (*SearchCriteria) PrepareHeader

func (c *SearchCriteria) PrepareHeader()

type SearchDirectory

type SearchDirectory struct {
	Message
	Context  context.Context
	Criteria *SearchCriteria
}

type SearchResults

type SearchResults struct {
	Message
	Uids []models.UID
}

type SortCriterion

type SortCriterion struct {
	Field   SortField
	Reverse bool
}

type SortField

type SortField int
const (
	SortArrival SortField = iota
	SortCc
	SortDate
	SortFrom
	SortRead
	SortSize
	SortSubject
	SortTo
	SortFlagged
)

type StartSendingMessage

type StartSendingMessage struct {
	Message
	From   *mail.Address
	Rcpts  []*mail.Address
	CopyTo string
}

type Thread

type Thread struct {
	Uid         models.UID
	Parent      *Thread
	PrevSibling *Thread
	NextSibling *Thread
	FirstChild  *Thread

	Hidden  int  // if this flag is not zero the message isn't rendered in the UI
	Deleted bool // if this flag is set the message was deleted

	// if this flag is set the message is the root of an incomplete thread
	Dummy bool

	// Context indicates the message doesn't match the mailbox / query but
	// is displayed for context
	Context bool
}

func (*Thread) AddChild

func (t *Thread) AddChild(child *Thread)

AddChild appends the child node at the end of the existing children of t.

func (*Thread) InsertCmp

func (t *Thread) InsertCmp(child *Thread, bigger func(*Thread, *Thread) bool)

InsertCmp inserts child as a child node into t in ascending order. The ascending order is determined by the bigger function that compares the child with the existing children. It should return true when the child is bigger than the other, and false otherwise.

func (*Thread) OrderedInsert

func (t *Thread) OrderedInsert(child *Thread)

OrderedInsert inserts the child node in ascending order among the existing children based on their respective UIDs.

func (*Thread) Root

func (t *Thread) Root() *Thread

Root returns the root thread of the thread tree

func (*Thread) String

func (t *Thread) String() string

func (*Thread) Uids

func (t *Thread) Uids() []models.UID

Uids returns all associated uids for the given thread and its children

func (*Thread) Walk

func (t *Thread) Walk(walkFn NewThreadWalkFn) error

type Unsupported

type Unsupported struct {
	Message
}

type Worker

type Worker struct {
	Backend Backend

	sync.Mutex
	log.Logger
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(name string) *Worker

func (*Worker) Actions

func (worker *Worker) Actions() chan WorkerMessage

func (*Worker) PathSeparator

func (worker *Worker) PathSeparator() string

func (*Worker) PostAction

func (worker *Worker) PostAction(msg WorkerMessage, cb func(msg WorkerMessage))

PostAction posts an action to the worker. This method should not be called from the same goroutine that the worker runs in or deadlocks may occur

func (*Worker) PostMessage

func (worker *Worker) PostMessage(msg WorkerMessage,
	cb func(msg WorkerMessage),
)

PostMessage posts an message to the UI. This method should not be called from the same goroutine that the UI runs in or deadlocks may occur

func (*Worker) ProcessAction

func (worker *Worker) ProcessAction(msg WorkerMessage) WorkerMessage

func (*Worker) ProcessMessage

func (worker *Worker) ProcessMessage(msg WorkerMessage) WorkerMessage

func (*Worker) Unwrap

func (worker *Worker) Unwrap() WorkerInteractor

type WorkerInteractor

type WorkerInteractor interface {
	log.Logger
	Actions() chan WorkerMessage
	ProcessAction(WorkerMessage) WorkerMessage
	PostAction(WorkerMessage, func(msg WorkerMessage))
	PostMessage(WorkerMessage, func(msg WorkerMessage))
	Unwrap() WorkerInteractor
}

type WorkerMessage

type WorkerMessage interface {
	InResponseTo() WorkerMessage

	Account() string
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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