maildir

package
v0.0.0-...-00f1f15 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2015 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package maildir implements access to DJB's maildir format.

The type Maildir is a string of the path to the maildir. The type Unique is a string of a unique maildir message identifier. The type CurMail is a handle on a message that has been delivered.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurMail

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

CurMail is a handle on an Acknowledge()ed (not newly-delivered) message in the maildir.

func (*CurMail) Delete

func (m *CurMail) Delete() error

Delete the message.

func (*CurMail) GetInfo

func (m *CurMail) GetInfo() string

GetInfo returns the info string for the message, which "is morally equivalent to the Status field used by mbox readers."

This package treats info as an opaque string, but obviously it would be good for it to have a common format between implementations. See <http://cr.yp.to/proto/maildir.html> for a recomendation for common semantics.

func (*CurMail) GetUnique

func (m *CurMail) GetUnique() Unique

GetUnique returns the unique idenfier for the message.

func (*CurMail) Reader

func (m *CurMail) Reader() Reader

Reader returns an io.{Reader,Seeker,Closer} for the message, so that you can read its contents.

func (*CurMail) SetInfo

func (m *CurMail) SetInfo(info string) error

SetInfo sets the info string for the message, which "is morally equivalent to the Status field used by mbox readers."

This package treats info as an opaque string, but obviously it would be good for it to have a common format between implementations. See <http://cr.yp.to/proto/maildir.html> for a recomendation for common semantics.

type Maildir

type Maildir string

A Maildir is simply a string pathname to where the maildir is.

func (Maildir) Acknowledge

func (md Maildir) Acknowledge(u Unique) (mail *CurMail, err error)

Acknowledge a newly delivered message (marking it as no longer newly delivered), and return a handle on it.

func (Maildir) Clean

func (md Maildir) Clean() error

Clean (remove) files in `md+"/tmp/"` not accessed in the last 36 hours.

func (Maildir) ListCur

func (md Maildir) ListCur() (mails []*CurMail, err error)

ListCur lists current/old messages in the maildir.

func (Maildir) ListNew

func (md Maildir) ListNew() (mails []Unique, err error)

ListNew lists the identifiers of newly delivered messages in the maildir.

func (Maildir) NewMail

func (md Maildir) NewMail() Writer

NewMail starts the delivery of a new message to the maildir. This function returns an io.WriteCloser; when .Close() is called on it, the message is delivered.

func (Maildir) Open

func (md Maildir) Open(u Unique) (mail *CurMail, err error)

Open the previously Acknowledg()ed message with the given unique identifier.

type Reader

type Reader interface {
	io.Reader
	io.Closer
	io.Seeker
}

Reader is the union of io.{Reader,Closer,Seeker}.

type Unique

type Unique string

A Unique is a string that uniquely identifies a message in the maildir. The format of the string is opaque.

"Unless you're writing messages to a maildir, the format of a
unique name is none of your business. A unique name can be
anything that doesn't contain a colon (or slash) and doesn't
start with a dot. Do not try to extract information from unique
names." -- http://cr.yp.to/proto/maildir.html

Fortunatley for you, even if you are writing messages to a maildir, this package takes care of it, so the format of the unique name is still none of your business.

type Writer

type Writer interface {
	io.WriteCloser
	Cancel() error
	Unique() Unique
}

Writer is an interface for writing a message to the maildir.

Jump to

Keyboard shortcuts

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