mailbox

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 9 Imported by: 4

Documentation

Overview

Package mailbox provides mailbox handlers for a fbb.Session.

Index

Constants

View Source
const (
	DIR_INBOX   = "/in/"
	DIR_OUTBOX  = "/out/"
	DIR_SENT    = "/sent/"
	DIR_ARCHIVE = "/archive/"
)
View Source
const Ext = ".b2f"

Variables

This section is empty.

Functions

func DefaultAppDir deprecated

func DefaultAppDir() (string, error)

Deprecated: implementers should choose their own directories

func DefaultMailboxPath deprecated

func DefaultMailboxPath() (string, error)

Deprecated: implementers should choose their own directories

func IsUnread

func IsUnread(msg *fbb.Message) bool

IsUnread returns true if the given message is marked as unread.

func LoadMessageDir

func LoadMessageDir(dirPath string) ([]*fbb.Message, error)

func OpenMessage

func OpenMessage(path string) (*fbb.Message, error)

OpenMessage opens a single a fbb.Message file.

func SetUnread

func SetUnread(msg *fbb.Message, unread bool) error

SetUnread marks the given message as read/unread and re-writes the file to disk.

func UserPath

func UserPath(root, callsign string) string

Types

type DirHandler

type DirHandler struct {
	MBoxPath string
	// contains filtered or unexported fields
}

NewDirHandler is a file system (directory) oriented mailbox handler.

func NewDirHandler

func NewDirHandler(path string, sendOnly bool) *DirHandler

NewDirHandler wraps the directory given by path as a DirHandler.

If sendOnly is true, all inbound messages will be deferred.

func (*DirHandler) AddOut

func (h *DirHandler) AddOut(msg *fbb.Message) error

func (*DirHandler) Archive

func (h *DirHandler) Archive() ([]*fbb.Message, error)

func (*DirHandler) ArchiveCount

func (h *DirHandler) ArchiveCount() int

func (*DirHandler) GetInboundAnswer

func (h *DirHandler) GetInboundAnswer(p fbb.Proposal) fbb.ProposalAnswer

func (*DirHandler) GetOutbound

func (h *DirHandler) GetOutbound(fws ...fbb.Address) []*fbb.Message

func (*DirHandler) Inbox

func (h *DirHandler) Inbox() ([]*fbb.Message, error)

func (*DirHandler) InboxCount

func (h *DirHandler) InboxCount() int

InboxCount returns the number of messages in the inbox. -1 on error.

func (*DirHandler) Outbox

func (h *DirHandler) Outbox() ([]*fbb.Message, error)

func (*DirHandler) OutboxCount

func (h *DirHandler) OutboxCount() int

func (*DirHandler) Prepare

func (h *DirHandler) Prepare() (err error)

func (*DirHandler) ProcessInbound

func (h *DirHandler) ProcessInbound(msgs ...*fbb.Message) (err error)

func (*DirHandler) Sent

func (h *DirHandler) Sent() ([]*fbb.Message, error)

func (*DirHandler) SentCount

func (h *DirHandler) SentCount() int

func (*DirHandler) SetDeferred

func (h *DirHandler) SetDeferred(MID string)

func (*DirHandler) SetSent

func (h *DirHandler) SetSent(MID string, rejected bool)

Jump to

Keyboard shortcuts

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