Documentation
¶
Overview ¶
Package pop3 is the POP3 receiving backend (ADR 0037, spec #627). A POP3 server has one inbox and no flags: a message's server location is its UIDL, flags and moves stay local, and only Purge writes back (DELE).
Index ¶
- Constants
- Variables
- type Config
- type Receiver
- func (r *Receiver) Apply(ctx context.Context, op backend.Op) (backend.Result, error)
- func (r *Receiver) Check(ctx context.Context) (backend.CheckResult, error)
- func (r *Receiver) Close() error
- func (r *Receiver) Describe(ctx context.Context) (backend.Description, error)
- func (r *Receiver) Fetch(ctx context.Context, req backend.ContentRequest) (io.ReadCloser, error)
- func (r *Receiver) Find(ctx context.Context, _ backend.FolderRef, messageID string, size int64) ([]backend.MessageRef, error)
- func (r *Receiver) Headers(ctx context.Context, _ backend.FolderRef, refs []backend.MessageRef, ...) (map[backend.MessageRef][]byte, error)
- func (r *Receiver) Sync(ctx context.Context, req backend.SyncRequest, commit func(backend.Page) error) (more bool, err error)
- func (r *Receiver) Watch(context.Context, func([]backend.FolderRef)) error
Constants ¶
const ( ReasonLocalMove = "pop3.local_move" // moves happen on this computer only ReasonLocalFlags = "pop3.local_flags" // flags are kept on this computer only ReasonInboxOnly = "pop3.inbox_only" // a POP3 server has only an inbox ReasonNone = "pop3.not_provided" ReasonNoUIDL = "pop3.no_uidl" )
Reason keys, translated by the UI and Wit.
const Inbox backend.FolderRef = "INBOX"
Inbox is the one folder's ref.
Variables ¶
var ErrNoUIDL = errors.New(ReasonNoUIDL)
ErrNoUIDL means the server lacks UIDL, so messages cannot be told apart across sessions. Its message is ReasonNoUIDL.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string
Port int
Security conn.Security
Credentials backend.CredentialsFunc
// PageBytes bounds the raw mail one sync page holds before it is
// committed, as whole messages can be large; 0 for 32 MiB.
PageBytes int64
}
Config is where a POP3 account's server is and how to sign in to it.
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver is a POP3 account's receiving backend. Message numbers hold only within a session, so each call signs in, works and QUITs.
func (*Receiver) Apply ¶
Apply implements backend.Receiver. Flags are kept locally and the server has only the inbox, so only Purge reaches the server.
func (*Receiver) Describe ¶
Describe implements backend.Receiver. It signs in once per Receiver, as core takes its answer for the credentials working (ErrAuthFailed).
func (*Receiver) Fetch ¶
func (r *Receiver) Fetch(ctx context.Context, req backend.ContentRequest) (io.ReadCloser, error)
Fetch implements backend.Receiver: the whole message with RETR, header fields with TOP n 0. POP3 gives no parts.
func (*Receiver) Find ¶
func (r *Receiver) Find(ctx context.Context, _ backend.FolderRef, messageID string, size int64) ([]backend.MessageRef, error)
Find implements backend.Receiver: it reads the header of each message in the inbox, of those of the size when one is given.
func (*Receiver) Headers ¶
func (r *Receiver) Headers(ctx context.Context, _ backend.FolderRef, refs []backend.MessageRef, fields []string) (map[backend.MessageRef][]byte, error)
Headers implements backend.Receiver, with TOP n 0 for each.
func (*Receiver) Sync ¶
func (r *Receiver) Sync(ctx context.Context, req backend.SyncRequest, commit func(backend.Page) error) (more bool, err error)
Sync implements backend.Receiver. Gone locations are reported one by one, not as a snapshot, which would reset the local-only flags. The first round takes the window's mail as backfill, page by page; later rounds take what came after the cursor's message as new; Older takes mail before the oldest one held.