From 0ca4624195cdd8c78ff614e3912af5b914458497 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 26 Aug 2026 13:28:51 +0200 Subject: feat: flag what you answered, mark what was forwarded to you Item 68, which turned out to be three things once its premise was measured. The note asked to extend a "passed" subject rule to "Fw:"; there was no subject rule, and the correlation it rested on did not exist. What did exist was a gap nobody had reported. Reply and forward now flag their source. The Maildir R and P flags, which every other client sets and notmuch reads back as "replied" and "passed", had never been written here: measured on the developer's index, all 317 "replied" and all 6 "passed" came from other clients. ComposeWindow emits sourceMessageAnswered after a successful send and MainWindow routes it through sendMessageTagChange, message-scoped and off the undo stack, for the reason auto mark-read is: the flag records that the mail went, and the send cannot be undone. ComposeContext carries sourceMessageId rather than reusing inReplyTo, which is deliberately empty on a forward so the recipient's client does not file it under the thread it left. Keying on it made the "passed" half dead code that compiled and never fired. A resumed draft is excluded: its kind records how the file was opened, not what the user is doing, so flagging on it would set R from a guess. A received forward gets its own mark. Derived from the subject at paint time, storing nothing and reaching no server, because "passed" means "I forwarded this" and setting it from a guess would assert something false on 222 existing messages. subjectIsForwarded() shares forwardSubject()'s prefix table so the two cannot disagree, strips a Re: chain first, and takes extra locale spellings from [general] forward_prefixes, which extends the built-in table rather than replacing it. A mutation survived the first round and corrected a claim in the code: QRegularExpression::escape already makes a punctuation prefix inert, so the word guard is not about pattern validity. It stops a configured "-" matching "-: x". The comment and test say that now. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01LXCZFLXbAii5n5wtovpdhh --- src/composecontext.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/composecontext.h') diff --git a/src/composecontext.h b/src/composecontext.h index 6f311c7..b94d0f8 100644 --- a/src/composecontext.h +++ b/src/composecontext.h @@ -168,6 +168,26 @@ QString replySubject(const QString &original); QString forwardSubject(const QString &original); +/// True when \p subject reads as a message someone forwarded TO the user. +/// +/// Item 68. This is a DISPLAY predicate: the card draws a mark from it and +/// stores nothing. It must never write a tag or a Maildir flag, because +/// `passed` (the `P` flag) means "I forwarded this" and is a different fact +/// about a different person. Setting it from a subject guess would assert +/// something false and, with maildir.synchronize_flags on, propagate that to +/// the server. +/// +/// Matches the same prefix table forwardSubject() uses, so the set of +/// recognised spellings cannot drift between "do not double the prefix" and +/// "this is a forward". \p extraPrefixes adds locale spellings the built-in +/// table omits, from `[general] forward_prefixes`; each is a bare word without +/// its colon ("doorst", "vs"). An entry that is empty or not a word is ignored. +/// +/// A `Re:` chain is stripped first, so `Re: Fwd: x` is recognised: a reply to +/// a forward is still a forward the user received. +bool subjectIsForwarded(const QString &subject, + const QStringList &extraPrefixes = {}); + /// Builds the context that RESUMES a draft from its file. /// /// Unlike a reply, nothing here is derived: the recipients, the subject and -- cgit v1.2.3