| Age | Commit message (Collapse) | Author | Files | Lines |
|
Both readers learn it together, as the rule format requires. No version
bump: the field is optional, and each writer emits it only on a rule that
removes inbox, so a file without one saves unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
A rule may carry "move": "spam" | "trash", an account role rather than a
folder name. The post-new hook moves each matching tag:new message into
its own account's configured folder under a fresh Maildir name in cur/,
records the renames with one notmuch new --no-hooks, then tags +spam or
+deleted, -inbox and the account-relative moved-from: origin. unread is
never touched. A message with several files, in no account, or whose
account has no folder for the role is logged and left alone, and a
configured folder that does not exist is never created.
Also fixes _quote, which escaped quotes with a backslash notmuch does not
honour, so an id holding a quote matched nothing on the carve-out path.
Item 214.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
The post-new hook and its rule store move here from the companion mailctl
project, which is being retired. Nothing else was shared between the two, so
this is a plain move: mailrules.py is stdlib-only and post-new imports only
it.
With that in hand, the hook learns the one thing it could not know before.
notmuch's new.tags applies `inbox` to every file it indexes, and it cannot
tell an arrival from the copy this application files into a sent folder after
a send, so sent mail turned up in the inbox view and in any hand-typed
tag:inbox search. Drafts arrived the same way, through the composer's
autosave. 786 messages were affected on the developer's own index.
qtmaildirconf.py reads the sent and drafts folders out of qtmaildir.conf, so
adding an account fixes itself. Reading the application's own config is not
the cross-repo coupling it would have been last week: this repo owns the hook
now.
Three properties are load-bearing:
- it is NOT a relaxation of PROTECTED_REMOVALS, which is about a rule
removing `inbox` from mail whose provenance the hook cannot judge. Here
the provenance is the file's own path, and `inbox` was never true of it.
- only `inbox`. maildir.synchronize_flags is true, so removing `unread`
would rewrite Maildir filenames and reach the server on the next mbsync.
- an empty folder list means NOTHING, never an empty query, which notmuch
reads as "match everything". A system with no qtmaildir config must be
left alone rather than have every new message stripped.
Trash is deliberately not in the list: Delete leaves `inbox` on a trashed
message so Restore can put it back where it came from.
The three Python suites run under ctest rather than beside it as scripts
someone remembers to run, since this code tags real mail unattended on every
sync.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2koFevoSxTLhfexJTZWQd
|