imap

package
v0.0.0-...-29413dc Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Automatically detect behaviour from the first reply.
	ExpungePolicyAuto = iota
	// The server deletes message in increasing sequence number. After each
	// delete, outstanding messages need to have their sequence numbers
	// decremented.
	ExpungePolicyLowToHigh
	// The server deletes messages in any order, but does not change any of the
	// sequence numbers.
	ExpungePolicyStable
)

The IMAP server behaviour when deleting multiple messages.

View Source
const (
	Unknown imapProvider = iota
	GMail
	Proton
	Office365
	Zoho
	FastMail
)
View Source
const NonExistentAttr = "\\NonExistent"

Variables

This section is empty.

Functions

func NewIMAPWorker

func NewIMAPWorker(worker *types.Worker) (types.Backend, error)

Types

type CachedHeader

type CachedHeader struct {
	BodyStructure models.BodyStructure
	Envelope      models.Envelope
	InternalDate  time.Time
	Uid           models.UID
	Size          uint32
	Header        []byte
	Created       time.Time
	Labels        []string
}

type ExpungeHandler

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

func NewExpungeHandler

func NewExpungeHandler(worker *IMAPWorker, uids []uint32, forDelete bool) *ExpungeHandler

Create a new ExpungeHandler for a list of UIDs that are being deleted or moved.

func (*ExpungeHandler) IsExpungingForDelete

func (h *ExpungeHandler) IsExpungingForDelete(uid uint32) bool

func (*ExpungeHandler) PopSequenceNumber

func (h *ExpungeHandler) PopSequenceNumber(seqNum uint32) (uint32, bool)

Translate the sequence number received from the IMAP server into the associated UID, deduce the policy used by the server from the first reply, and update the remaining mappings according to that policy if required.

type IMAPWorker

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

func (*IMAPWorker) BuildExpungeHandler

func (w *IMAPWorker) BuildExpungeHandler(uids []uint32, forDelete bool)

func (*IMAPWorker) Capabilities

func (w *IMAPWorker) Capabilities() *models.Capabilities

func (*IMAPWorker) PathSeparator

func (w *IMAPWorker) PathSeparator() string

func (*IMAPWorker) Run

func (w *IMAPWorker) Run()

type SeqMap

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

func (*SeqMap) Get

func (s *SeqMap) Get(seqnum uint32) (uint32, bool)

Get returns the UID of the given seqnum

func (*SeqMap) Initialize

func (s *SeqMap) Initialize(uids []uint32)

Initialize sets the initial seqmap of the mailbox

func (*SeqMap) Pop

func (s *SeqMap) Pop(seqnum uint32) (uint32, bool)

Pop removes seqnum from the SeqMap. seqnum must be a valid seqnum, ie [1:size of mailbox]

func (*SeqMap) Put

func (s *SeqMap) Put(uid uint32)

Put adds a UID to the slice. Put should only be used to add new messages into the slice

func (*SeqMap) Size

func (s *SeqMap) Size() int

func (*SeqMap) Snapshot

func (s *SeqMap) Snapshot(uids []uint32) (map[uint32]uint32, uint32)

Take a snapshot of the SequenceNumber=>UID mappings for the given UIDs, remove those UIDs from the SeqMap, and return the snapshot it to the caller, as well as the loweest sequence number it contains.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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