Expand description
Messages on disk: a Maildir (new/ and cur/), or a plain folder of .eml files.
Sioul writes what it fetches as a Maildir (https://cr.yp.to/proto/maildir.html),
so notmuch, mutt or any other reader can open the same folders. Each file
name carries where the message sits on the server, U<uidvalidity>-<uid>,
so the Porch knows what you have seen without opening the files.
After the flags, two IMAP keywords (RFC 9051 §2.3.2) are kept as Dovecot
keeps them: a lowercase letter each, named in the folder’s
dovecot-keywords file. They say what you, or a mail client, said of a
message: junk ($Junk), or not junk ($NotJunk).
Structs§
- Cards
Kept - While it lives, each message file this thread reads is parsed once
(
read_one): one look at the mail (the Porch, then the money lines it holds, each going through every message kept) parses each message once, not once each. Nothing is kept once it ends: a card holds a few kilobytes, and every message kept would stay in memory between looks. One begun inside another changes nothing. - Fetched
- A message fetched from the server, ready to be written.
- Keywords
- What a stored message’s file name says of it, junk or not.
Constants§
- INFO
- What separates a message’s unique name from its flags: “:” by the Maildir convention, “!” on Windows, where “:” cannot be in a file name (mbsync does the same). Both are read on every system.
- JUNK
$Junk’s letter.- KEPT 🔒
- The cards read in this thread while a
CardsKeptlives. - KEYWORDS
- The keywords kept, by letter, as the folder’s
dovecot-keywordsfile numbers them (a is 0, b is 1). - NOT_
JUNK $NotJunk’s letter.
Functions§
- flags_
of - The Maildir flags of a stored message, from its name, with the keywords’
letters: “FS”, “Sb”; none in
new/. - flags_
part 🔒 - The flags after “:2,” or “!2,”.
- has_
unread - Whether a Maildir holds a message not read yet: one in
new/, or one incur/without the S flag. Only names are read. - is_
hidden 🔒 - kept_
key 🔒 - A message file as
CardsKeptknows it: its name less its flags, its size, its time (nanoseconds). - keyword_
letter - The letter of an IMAP keyword Sioul keeps; none for the others. Case
does not matter:
$junkis$Junkto IMAP servers. - keywords_
of - The keywords in a stored message’s file name.
- locate
- Where a stored message is now: its flags rename it, and a first reading
moves it from
new/tocur/. The part of the name before “:2,” never changes. - message_
ids - The Message-IDs of a Maildir’s messages, from their headers only.
- name_
keywords 🔒 - The folder’s
dovecot-keywordsfile, which names the letters, written once, when a letter is first kept there: Dovecot reads the same folder alike. - origin_
of 1759400000.U1700000000-4521.sioul:2,S→ validity 1700000000, UID 4521.- read_
folder 🔒 - read_
messages - Every message of a Maildir or folder, oldest first.
- read_
messages_ where - The messages whose server origin passes
keep, oldest first; the others are not even read. - read_
one - One message file as a card. While a
CardsKeptlives in this thread, a message already read in it is not parsed again: the file’s name less its flags, its size and its time say it is the same (a message’s content never changes; its flags move it betweennew/andcur/). - set_
flags - Gives a stored message other flags: it is renamed in
cur/, where every message that has been seen or flagged lives. Returns where it is now. - sorted 🔒
- Maildir wants the flag letters in ASCII order.
- store
- Writes one message into a Maildir: first in
tmp/, then moved, so a reader never sees half a message. Mail without any flag goes tonew/; mail with some (read, flagged, a keyword kept) tocur/with its letters, as the Maildir convention says, so that none is lost until the next sync. - unique_
part - “1759400000.U17-4521.sioul:2,FS” → “1759400000.U17-4521.sioul”.