alpsbase

package
v0.0.0-...-827a3b8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrViewUnsupported = fmt.Errorf("cannot generate message view: unsupported part")

ErrViewUnsupported is returned by Viewer.ViewMessagePart when the message part isn't supported.

Functions

func PrepareSearch

func PrepareSearch(terms string) *imap.SearchCriteria

TODO: Document search functionality somewhere

func RegisterViewer

func RegisterViewer(viewer Viewer)

RegisterViewer registers a message part viewer.

Types

type Attachment

type Attachment interface {
	MIMEType() string
	Filename() string
	Open() (io.ReadCloser, error)
}

type CategorizedMailboxes

type CategorizedMailboxes struct {
	Common struct {
		Inbox   *MailboxDetails
		Drafts  *MailboxDetails
		Sent    *MailboxDetails
		Junk    *MailboxDetails
		Trash   *MailboxDetails
		Archive *MailboxDetails
	}
	Additional []MailboxDetails
}

Organizes mailboxes into common/uncommon categories

func (*CategorizedMailboxes) Append

func (cc *CategorizedMailboxes) Append(mi MailboxInfo, status *MailboxStatus)

type ComposeRenderData

type ComposeRenderData struct {
	IMAPBaseRenderData
	Message *OutgoingMessage
}

type IMAPBaseRenderData

type IMAPBaseRenderData struct {
	alps.BaseRenderData
	CategorizedMailboxes CategorizedMailboxes
	Mailboxes            []MailboxInfo
	Mailbox              *MailboxStatus
	Inbox                *MailboxStatus
	Subscriptions        map[string]*MailboxStatus
}

type IMAPMessage

type IMAPMessage struct {
	*imapclient.FetchMessageBuffer

	Mailbox string
}

func (*IMAPMessage) Attachments

func (msg *IMAPMessage) Attachments() []IMAPPartNode

func (*IMAPMessage) HTMLPart

func (msg *IMAPMessage) HTMLPart() *IMAPPartNode

func (*IMAPMessage) HasFlag

func (msg *IMAPMessage) HasFlag(flag imap.Flag) bool

func (*IMAPMessage) PartByID

func (msg *IMAPMessage) PartByID(id string) *IMAPPartNode

func (*IMAPMessage) PartByPath

func (msg *IMAPMessage) PartByPath(path []int) *IMAPPartNode

func (*IMAPMessage) PartTree

func (msg *IMAPMessage) PartTree() *IMAPPartNode

func (*IMAPMessage) TextPart

func (msg *IMAPMessage) TextPart() *IMAPPartNode

func (*IMAPMessage) URL

func (msg *IMAPMessage) URL() *url.URL

type IMAPPartNode

type IMAPPartNode struct {
	Path     []int
	MIMEType string
	Filename string
	Children []IMAPPartNode
	Message  *IMAPMessage
	Size     uint32
}

func (IMAPPartNode) IsText

func (node IMAPPartNode) IsText() bool

func (IMAPPartNode) PathString

func (node IMAPPartNode) PathString() string

func (IMAPPartNode) SizeString

func (node IMAPPartNode) SizeString() string

func (IMAPPartNode) String

func (node IMAPPartNode) String() string

func (IMAPPartNode) URL

func (node IMAPPartNode) URL(raw bool) *url.URL

type MailboxDetails

type MailboxDetails struct {
	Info   *MailboxInfo
	Status *MailboxStatus
}

type MailboxInfo

type MailboxInfo struct {
	*imap.ListData

	Active bool
	Total  int
	Unseen int
}

func (*MailboxInfo) HasAttr

func (mbox *MailboxInfo) HasAttr(flag string) bool

func (*MailboxInfo) Name

func (mbox *MailboxInfo) Name() string

func (*MailboxInfo) URL

func (mbox *MailboxInfo) URL() *url.URL

type MailboxRenderData

type MailboxRenderData struct {
	IMAPBaseRenderData
	Messages           []IMAPMessage
	PrevPage, NextPage int
	Query              string
}

type MailboxStatus

type MailboxStatus struct {
	*imap.StatusData
}

func (*MailboxStatus) Name

func (mbox *MailboxStatus) Name() string

func (*MailboxStatus) URL

func (mbox *MailboxStatus) URL() *url.URL

type MessageRenderData

type MessageRenderData struct {
	IMAPBaseRenderData
	Message     *IMAPMessage
	Part        *IMAPPartNode
	View        interface{}
	MailboxPage int
	Flags       map[imap.Flag]bool
}

type NewMailboxRenderData

type NewMailboxRenderData struct {
	IMAPBaseRenderData
	Error string
}

type OutgoingMessage

type OutgoingMessage struct {
	From        string
	To          []string
	Cc          []string
	Bcc         []string
	Subject     string
	MessageID   string
	InReplyTo   string
	Text        string
	Attachments []Attachment
}

func (*OutgoingMessage) ToString

func (msg *OutgoingMessage) ToString() string

func (*OutgoingMessage) WriteTo

func (msg *OutgoingMessage) WriteTo(w io.Writer) error

type Settings

type Settings struct {
	MessagesPerPage int
	Signature       string
	From            string
	Subscriptions   []string
}

type SettingsRenderData

type SettingsRenderData struct {
	alps.BaseRenderData
	Mailboxes     []MailboxInfo
	Settings      *Settings
	Subscriptions Subscriptions
}

type Subscriptions

type Subscriptions []string

func (Subscriptions) Has

func (s Subscriptions) Has(sub string) bool

type Viewer

type Viewer interface {
	// ViewMessagePart renders a message part. The returned value is displayed
	// in a template. ErrViewUnsupported is returned if the message part isn't
	// supported.
	ViewMessagePart(*alps.Context, *IMAPMessage, *message.Entity) (interface{}, error)
}

Viewer is a message part viewer.

Jump to

Keyboard shortcuts

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