Implements a three-phase Sieve email filtering pipeline: - Data models (SieveCondition, SieveAction, SieveRule) as sealed Dart classes - SieveParser: converts RFC 5228 Sieve scripts to a flat SieveRule list, supporting if/elsif/else, allof/anyof, header/size/exists tests, and all common actions (fileinto, keep, discard, flag, mark) - SieveInterpreter: evaluates compiled rules against a SieveEmailContext, tracking routing state in SieveExecutionContext with implicit keep behaviour - 40 unit tests covering parser correctness and interpreter execution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
439 B
Dart
15 lines
439 B
Dart
sealed class SieveCondition {}
|
|
|
|
final class HeaderCondition extends SieveCondition {
|
|
HeaderCondition(this.headers, this.matchType, this.keyList);
|
|
final List<String> headers;
|
|
final String matchType; // ':contains', ':is', ':matches'
|
|
final List<String> keyList;
|
|
}
|
|
|
|
final class SizeCondition extends SieveCondition {
|
|
SizeCondition(this.comparison, this.bytes);
|
|
final String comparison; // ':over' or ':under'
|
|
final int bytes;
|
|
}
|