imapmemserver

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package imapmemserver implements an in-memory IMAP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailbox

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

Mailbox is an in-memory mailbox.

The same mailbox can be shared between multiple connections and multiple users.

func NewMailbox

func NewMailbox(name string, uidValidity uint32) *Mailbox

NewMailbox creates a new mailbox.

func (*Mailbox) Expunge

func (mbox *Mailbox) Expunge(w *imapserver.ExpungeWriter, uids *imap.UIDSet) error

func (*Mailbox) NewView

func (mbox *Mailbox) NewView() *MailboxView

NewView creates a new view into this mailbox.

Callers must call MailboxView.Close once they are done with the mailbox view.

func (*Mailbox) SetSubscribed

func (mbox *Mailbox) SetSubscribed(subscribed bool)

SetSubscribed changes the subscription state of this mailbox.

func (*Mailbox) StatusData

func (mbox *Mailbox) StatusData(options *imap.StatusOptions) *imap.StatusData

StatusData returns data for the STATUS command.

type MailboxView

type MailboxView struct {
	*Mailbox
	// contains filtered or unexported fields
}

A MailboxView is a view into a mailbox.

Each view has its own queue of pending unilateral updates.

Once the mailbox view is no longer used, Close must be called.

Typically, a new MailboxView is created for each IMAP connection in the selected state.

func (*MailboxView) Close

func (mbox *MailboxView) Close()

Close releases the resources allocated for the mailbox view.

func (*MailboxView) Fetch

func (mbox *MailboxView) Fetch(w *imapserver.FetchWriter, numSet imap.NumSet, options *imap.FetchOptions) error

func (*MailboxView) Idle

func (mbox *MailboxView) Idle(w *imapserver.UpdateWriter, stop <-chan struct{}) error

func (*MailboxView) Poll

func (mbox *MailboxView) Poll(w *imapserver.UpdateWriter, allowExpunge bool) error

func (*MailboxView) Search

func (mbox *MailboxView) Search(numKind imapserver.NumKind, criteria *imap.SearchCriteria, options *imap.SearchOptions) (*imap.SearchData, error)

func (*MailboxView) Store

func (mbox *MailboxView) Store(w *imapserver.FetchWriter, numSet imap.NumSet, flags *imap.StoreFlags, options *imap.StoreOptions) error

type Server

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

Server is a server instance.

A server contains a list of users.

func New

func New() *Server

New creates a new server.

func (*Server) AddUser

func (s *Server) AddUser(user *User)

AddUser adds a user to the server.

func (*Server) NewSession

func (s *Server) NewSession() imapserver.Session

NewSession creates a new IMAP session.

type User

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

func NewUser

func NewUser(username, password string) *User

func (*User) Append

func (u *User) Append(mailbox string, r imap.LiteralReader, options *imap.AppendOptions) (*imap.AppendData, error)

func (*User) Create

func (u *User) Create(name string, options *imap.CreateOptions) error

func (*User) Delete

func (u *User) Delete(name string) error

func (*User) List

func (u *User) List(w *imapserver.ListWriter, ref string, patterns []string, options *imap.ListOptions) error

func (*User) Login

func (u *User) Login(username, password string) error

func (*User) Namespace

func (u *User) Namespace() (*imap.NamespaceData, error)

func (*User) Rename

func (u *User) Rename(oldName, newName string) error

func (*User) Status

func (u *User) Status(name string, options *imap.StatusOptions) (*imap.StatusData, error)

func (*User) Subscribe

func (u *User) Subscribe(name string) error

func (*User) Unsubscribe

func (u *User) Unsubscribe(name string) error

type UserSession

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

UserSession represents a session tied to a specific user.

UserSession implements imapserver.Session. Typically, a UserSession pointer is embedded into a larger struct which overrides Login.

func NewUserSession

func NewUserSession(user *User) *UserSession

NewUserSession creates a new user session.

func (*UserSession) Close

func (sess *UserSession) Close() error

func (*UserSession) Copy

func (sess *UserSession) Copy(numSet imap.NumSet, destName string) (*imap.CopyData, error)

func (*UserSession) Idle

func (sess *UserSession) Idle(w *imapserver.UpdateWriter, stop <-chan struct{}) error

func (*UserSession) Move

func (sess *UserSession) Move(w *imapserver.MoveWriter, numSet imap.NumSet, destName string) error

func (*UserSession) Poll

func (sess *UserSession) Poll(w *imapserver.UpdateWriter, allowExpunge bool) error

func (*UserSession) Select

func (sess *UserSession) Select(name string, options *imap.SelectOptions) (*imap.SelectData, error)

func (*UserSession) Unselect

func (sess *UserSession) Unselect() error

Jump to

Keyboard shortcuts

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