maildir

package
v0.0.0-...-f80805b Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package maildir implements parsing of maildir folders.

Index

Constants

This section is empty.

Variables

View Source
var Messages map[string]*Message

Messages is a map of IDs/names to messages.

Functions

func DeleteMessage

func DeleteMessage(key string) error

DeleteMessage deletes a message from Messages and the filesystem.

func Watch

func Watch(dir string)

Watch watches dir for changes and populates Messages based on received events.

Types

type Body

type Body struct {
	Plain string
	HTML  string
}

Body holds multipart mail bodies for a single message.

type ByDate

type ByDate []*Message

ByDate implements sort.Interface for []Message based on the Date field.

func (ByDate) Len

func (a ByDate) Len() int

func (ByDate) Less

func (a ByDate) Less(i, j int) bool

func (ByDate) Swap

func (a ByDate) Swap(i, j int)

type Flag

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

Flag holds flags parsed from maildir filenames.

func (*Flag) Get

func (f *Flag) Get(r rune) bool

Get gets the boolean value of flag r.

func (*Flag) Not

func (f *Flag) Not(r rune) bool

Not is the inverse of Get. Useful for templates.

func (*Flag) Write

func (f *Flag) Write(r rune) error

Write writes flag r to the filesystem if it doesn't already exist.

type Message

type Message struct {
	Date     time.Time
	ID       string
	From     []*mail.Address
	FromName string
	To       []*mail.Address
	Subject  string
	Body     Body
	Flag     Flag
	// contains filtered or unexported fields
}

Message represents a single mail message.

func Sorted

func Sorted() []*Message

Sorted returns Messages sorted by date descending.

func (*Message) Time

func (m *Message) Time() string

Time returns a formatted time string.

Jump to

Keyboard shortcuts

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