memory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemDbFileName = "memDB.json"
)

Variables

This section is empty.

Functions

func InitDefaultData

func InitDefaultData(memHome string) (err error)

Types

type ImapMailBox

type ImapMailBox struct {
	Subscribed bool
	BName      string
	BInfo      *imap.MailboxInfo
	Messages   MessageList
	User       *ImapUser
}

func (*ImapMailBox) Check

func (mailbox *ImapMailBox) Check() error

func (*ImapMailBox) CopyMessages

func (mailbox *ImapMailBox) CopyMessages(uid bool, seqset *imap.SeqSet, destName string) error

func (*ImapMailBox) CreateMessage

func (mailbox *ImapMailBox) CreateMessage(flags []string, date time.Time, body imap.Literal) error

func (*ImapMailBox) Expunge

func (mailbox *ImapMailBox) Expunge() error

func (*ImapMailBox) Info

func (mailbox *ImapMailBox) Info() (*imap.MailboxInfo, error)

func (*ImapMailBox) ListMessages

func (mailbox *ImapMailBox) ListMessages(uid bool, seqSet *imap.SeqSet, items []imap.FetchItem, ch chan<- *imap.Message) error

func (*ImapMailBox) Name

func (mailbox *ImapMailBox) Name() string

func (*ImapMailBox) SearchMessages

func (mailbox *ImapMailBox) SearchMessages(uid bool, criteria *imap.SearchCriteria) ([]uint32, error)

func (*ImapMailBox) SetSubscribed

func (mailbox *ImapMailBox) SetSubscribed(subscribed bool) error

func (*ImapMailBox) Status

func (mailbox *ImapMailBox) Status(items []imap.StatusItem) (*imap.MailboxStatus, error)

func (*ImapMailBox) UpdateMessagesFlags

func (mailbox *ImapMailBox) UpdateMessagesFlags(uid bool, seqset *imap.SeqSet, operation imap.FlagsOp, flags []string) error

type ImapUser

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

func NewUser

func NewUser(user, pwd string, de *MemDB) *ImapUser

func (*ImapUser) CreateMailbox

func (user *ImapUser) CreateMailbox(name string) error

func (*ImapUser) DeleteMailbox

func (user *ImapUser) DeleteMailbox(name string) error

func (*ImapUser) GetMailbox

func (user *ImapUser) GetMailbox(name string) (backend.Mailbox, error)

func (*ImapUser) ListMailboxes

func (user *ImapUser) ListMailboxes(subscribed bool) ([]backend.Mailbox, error)

func (*ImapUser) Logout

func (user *ImapUser) Logout() error

func (*ImapUser) RenameMailbox

func (user *ImapUser) RenameMailbox(existingName, newName string) error

func (*ImapUser) Username

func (user *ImapUser) Username() string

type MailBoxGroup

type MailBoxGroup map[string]*ImapMailBox

func (MailBoxGroup) Copy

func (mbg MailBoxGroup) Copy() MailBoxGroup

type MemDB

type MemDB struct {
	sync.RWMutex

	Users     map[string]string
	MailBoxes MailBoxGroup
	// contains filtered or unexported fields
}

func NewMemDB

func NewMemDB() *MemDB

func (*MemDB) Login

func (m *MemDB) Login(_ *imap.ConnInfo, username, password string) (backend.User, error)

func (*MemDB) LogoutFromImap

func (m *MemDB) LogoutFromImap(user *ImapUser)

func (*MemDB) MailBoxGrp

func (m *MemDB) MailBoxGrp(user *ImapUser) MailBoxGroup

func (*MemDB) NewSession

func (m *MemDB) NewSession(c *smtp.Conn) (smtp.Session, error)

type Message

type Message struct {
	Uid   uint32
	Date  time.Time
	Size  uint32
	Flags []string
	Body  []byte
}

func (*Message) Fetch

func (m *Message) Fetch(seqNum uint32, items []imap.FetchItem) (*imap.Message, error)

func (*Message) Match

func (m *Message) Match(seqNum uint32, c *imap.SearchCriteria) (bool, error)

type MessageList

type MessageList []*Message

type SmtpSession

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

func (*SmtpSession) AuthPlain

func (ss *SmtpSession) AuthPlain(username, password string) error

func (*SmtpSession) Data

func (ss *SmtpSession) Data(r io.Reader) error

func (*SmtpSession) Logout

func (ss *SmtpSession) Logout() error

func (*SmtpSession) Mail

func (ss *SmtpSession) Mail(from string, opts *smtp.MailOptions) error

func (*SmtpSession) Rcpt

func (ss *SmtpSession) Rcpt(to string) error

func (*SmtpSession) Reset

func (ss *SmtpSession) Reset()

Jump to

Keyboard shortcuts

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