Skip to main content

Module remote

Module remote 

Source
Expand description

An IMAP folder mirrored into a local cache maildir, so the whole index/pager stack works on it unchanged. Filenames carry the UID and server size (<uid>.rmut,S=<size>); new messages start as header-only files (marked with a leading X-Rmut-Partial header) and get their full body on first view. Local flag changes and deletes are pushed with UID STORE / EXPUNGE on sync.

Structs§

Backfill
Background header mirror for the tail of a huge folder: a dedicated session fetches uids into the cache chunk by chunk; the caller’s poll rescan picks the files up as they land. Dropped (mailbox switch, quit) it stops at the next chunk boundary; best-effort; anything missed comes in with the next reconcile.
IdleWatch
Handle to a background IDLE watcher. Dropping it sets the stop flag; the thread notices within the socket’s 60 s read timeout and logs out.
Remote

Functions§

backfill
cache_base
$XDG_CACHE_HOME/rmut (or ~/.cache/rmut), shared by the IMAP, mbox, and notmuch mirrors.
cache_dir
Where a folder’s cache maildir lives: $XDG_CACHE_HOME/rmut/imap/<account>/<mailbox> (percent-encoded).
clean_mailbox
Tidy a mailbox name: collapse // runs and trim / from the ends (servers reject “adjacent hierarchy separators”); empty → INBOX. A mutt-style imap[s]:// URL (from an unconverted config) means the mailbox in its path.
data_base
$XDG_DATA_HOME/rmut (or ~/.local/share/rmut): what rmut keeps that is not a cache and must survive one being cleared.
idle_watch
Watch mailbox with IDLE on a dedicated connection, setting the handle’s flag whenever the server announces changes. Best-effort: when the server lacks IDLE (or anything fails) the thread just ends and the caller’s NOOP polling carries on as before.
is_partial
True for cached files that hold only the message headers so far.
parse_spec
imap:account[/mailbox] → (account, mailbox); INBOX when omitted.
uid_of
UID encoded in a cache filename (<uid>.rmut[,S=n][:2,flags]).

Type Aliases§

Progress
Sink for transient “what am I doing” lines during blocking IMAP work (connecting, fetching flags/headers); the UI decides how to show them.