https://gitlab.synchro.net/main/sbbs/-/commit/457571240a0de734b02589cc
Added Files:
exec/load/mailbox.js mailbox_files.js mailbox_mime.js mailbox_summary.js mailbox_tags.js mailsig.js exec/tests/mailbox/files.js kit.js mailsig.js read.js skipif store_limits.js store_read.js store_write.js summary.js tags.js
Log Message:
Mailbox library: one per-user mailbox for every front end (#945)
A stock library in exec/load that presents the system mail base and a
private per-user e-mail base as one mailbox, so the web, the terminal
and other services can share the same rules. The system mail base
stays the Inbox. What a user keeps (folders, Sent copies, Trash) lives
in data/user/NNNN/mailbox, created on the first write. Nothing calls
the library yet.
- mailbox.js (Store): folders, lists, search, delivery status of sent
mail and a change fingerprint; flags; moving mail between the Inbox
and folders; Trash with restore, emptying and expiry by
system.max_trash_age; folder create, rename and delete; a quota from
system.mailbox_quota; reading a message (text and HTML bodies,
attachments, file attachments, the original headers, a raw .eml).
- mailbox_tags.js: folders and flags as message header tags. Reserved
tags start with "$"; a user folder's tag is its percent-encoded name.
- mailbox_summary.js: a cached list of the private base with a running
usage total, updated in step with each write.
- mailbox_files.js: JSON side files with a locked read-modify-write.
- mailbox_mime.js: picks bodies and attachments from a message's parts
and turns attachment names into safe download names.
- mailsig.js: a separate UTF-8 mail signature, data/user/NNNN.mail.sig,
falling back to the general signature.
Rules the library enforces: a user can list, read, change or download
only mail addressed to them, mail they sent, and their own private
base. Deleting moves a message to Trash; removing it from Trash frees
its space. A move between the two bases is journaled, so one that is interrupted is finished on the next write without losing the message
or merging it with a look-alike. Mail older than the mail base's
maximum age is not put back in the Inbox, where maintenance would
delete it: a restore sends it to Archive instead. Errors returned to
callers carry a code and a fixed text, never a server path.
Each public call reopens the message bases, because an open base can
return stale index and header data after another handle rewrites a
record (#1356).
Tests are in exec/tests/mailbox and use scratch bases only. Run on
Linux only; nothing here has run on Windows.
Co-Authored-By: Claude Fable 5.2 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net