Class MailRuleDeclaration
- Namespace
- MailFathom.Application.Rules
- Assembly
- MailFathom.Application.dll
One rule exactly as it was declared, which is what a rule set's revision identity is derived from.
public sealed record MailRuleDeclaration : IEquatable<MailRuleDeclaration>
- Inheritance
-
MailRuleDeclaration
- Implements
- Inherited Members
Remarks
Deliberately separate from MailRule, which carries a compiled condition and no authored text. A declaration exists for the moment between binding and compiling: long enough to be hashed into a revision, and never held afterwards. A condition can legitimately contain an address its author typed, so keeping the text out of the rule that is passed around is what stops a run record that names a rule from carrying somebody's address with it.
The actions are part of the declaration for the same reason the condition is: what a rule does to the mail it selects is part of what the rule set means, so editing an action moves the revision and the edited rule asks the mailbox afresh instead of being read as the request it already performed.
The triggers are the resolved set rather than the text the file named them with, so a rule that leaves the key out and a rule that writes an empty list are one rule set rather than two, and so are two spellings of one trigger's name: they mean the same thing, and a revision that told them apart would supersede a run over an edit that changed nothing.
The schedule is the parsed recurrence rather than the text as well, and for the same reason: two spellings of one occasion are one rule set, so a revision that told them apart would supersede a run over an edit that changed nothing about when anything happens.
Constructors
- MailRuleDeclaration(string, string, IReadOnlyList<MailRuleAction>, bool, IReadOnlyList<string>, IReadOnlyList<MailRuleTrigger>, JobRecurrence?)
One rule exactly as it was declared, which is what a rule set's revision identity is derived from.
Properties
- Accounts
The accounts the rule was scoped to, in declared order, empty for a rule that applies to every account.
- Actions
What a match does to the matching email, in the order the changes are applied.
- ConditionText
The condition as the operator wrote it.
- Name
The name the rule is declared and reported under.
- StopWhenMatched
Whether a match ends the pass rather than continuing to the rules below.
- Triggers
The automatic triggers the rule takes part in, in declared order, empty for a rule only a requested walk runs.