https://gitlab.synchro.net/main/sbbs/-/commit/4481a15807362affffd3ac85
Added Files:
exec/tests/mailbox/store_refresh.js store_sent.js
Modified Files:
exec/load/mailbox.js mailbox_files.js mailbox_tags.js exec/tests/mailbox/files.js read.js store_limits.js store_read.js store_write.js tags.js
Log Message:
Mailbox library: Sent copies, safer shown text, fewer file operations
What a client that sends mail and changes mail needs from the Store:
- save_sent(header, body_path): a Sent copy saved from a body file
(never a JavaScript string), tagged $Sent $Unsent, from the user and
with no to_ext, so it never counts as mail received and cannot be
moved to the Inbox. Made inside one Summary.modify() after the move
journal is reconciled, under the quota rule of moves into the private
base. mark_sent(id) removes $Unsent once the mail was delivered;
remove_sent(id) removes an unsent copy for real (a delivered copy is
refused); find_sent(message_id) finds a copy whose number was never
recorded; set_replied(id) sets the replied attribute. A Sent copy
whose outcome is not known is tagged $Unknown and listed with
delivery "unknown". get().headers.bcc is the BCC list a Sent copy
keeps (for $Sent messages only).
- A Sent item whose delivery failed carries the id of the failure
notice (delivery.notice) while that notice is still in the user's
mail; the newest wins. A Sent page reads no extra header for it.
- inbox_max_age() is a public method: the days the Inbox keeps mail
(the mail base's max_age), 0 for no limit.
Text that is shown to the user:
- Recipient lists are parsed from the raw header first and each display
name is decoded afterwards. An encoded word that decodes to
"Alice <
alice@x.example>, Mallory" can no longer add a recipient to a
reply; before, the whole list was decoded and then parsed. get() adds
headers.to_list, cc_list and reply_to_list ([{name, addr}]), and to,
cc and reply_to are written from the same entries.
- Bidirectional controls (U+061C, U+200E, U+200F, U+202A to U+202E,
U+2066 to U+2069) are removed from decoded names and from the from,
to and subject of list items. The sender address is shown without
control characters and marked from_addr_bad when it held one.
- Folder names refuse those controls and the C1 control characters,
with the existing reason "invalid".
Fewer file operations per call, for a data directory on a network
mount:
- mailbox.js loads its tag, summary and MIME libraries, smbdefs.js and
822header.js on first use; state() needs none of them.
- refresh() uses the shared base handle that Store.open() made as it
is, for the first call only. Every later call reopens, because a
handle opened earlier returns header fields as of its open after
another handle rewrote them in place (#1356), and a flag change could
write those old fields back.
- JsonFiles.locked(name, fn) takes a file's lock without rewriting the
file; update() is built on it.
The move journal is not touched.
Tests in exec/tests/mailbox: store_sent.js and store_refresh.js are
new; read.js gains crafted To, Cc, Reply-To and From headers; files.js
covers locked(). Run on Linux only.
Co-Authored-By: Claude Fable 5.2 <
noreply@anthropic.com>
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)