aboutsummaryrefslogtreecommitdiffstats
path: root/src/tagrules.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-31 11:42:24 +0100
committerDanilo M. <danix@danix.xyz>2026-11-17 10:26:19 +0100
commita7d12f9608d1105e5f3d6da6ad6c9f3fa4d9b458 (patch)
treef5a3703c60090ed1cd67c7e7b0710e0868838e54 /src/tagrules.h
parent4161ac9a31e160c0dbdd8b1998a1895fe95dcf93 (diff)
downloadqtmaildir-a7d12f9608d1105e5f3d6da6ad6c9f3fa4d9b458.tar.gz
qtmaildir-a7d12f9608d1105e5f3d6da6ad6c9f3fa4d9b458.zip
feat: an optional allow_archive field on a tagging rule
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>
Diffstat (limited to 'src/tagrules.h')
-rw-r--r--src/tagrules.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tagrules.h b/src/tagrules.h
index 946329a..2ceafef 100644
--- a/src/tagrules.h
+++ b/src/tagrules.h
@@ -43,6 +43,10 @@ struct TagRule
QString move;
int stage = 50; ///< Ascending. Account tags 10, topic rules 50.
bool enabled = true;
+ /// Lets the post-new hook remove `inbox` from arriving mail for this rule
+ /// (item 213). Meaningless, and cleared on save, unless `remove` holds
+ /// `inbox`. `unread` stays refused regardless.
+ bool allowArchive = false;
/// Fields this version of qtmaildir does not understand, kept verbatim and
/// written back on save. Without this, one save from here silently strips
@@ -104,6 +108,11 @@ public:
/// could reach the file and never come back.
static QStringList validate(const QList<TagRule> &rules);
+ /// Whether the post-new hook will skip this rule whole. Mirrors
+ /// PROTECTED_REMOVALS in assets/hooks/post-new: `unread` always, `inbox`
+ /// unless the rule opts in with allowArchive.
+ static bool hookWouldSkip(const TagRule &rule);
+
/// No file yet, as distinct from a file that would not load. A fresh
/// install is not an error and must not be reported as one.
bool missing() const { return m_missing; }