Skip to content

Commit 9c6471a

Browse files
added ereject rfc5429
1 parent c8acda0 commit 9c6471a

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
'notify = sifter.commands.notify:CommandNotify',
6262
'redirect = sifter.commands.redirect:CommandRedirect',
6363
'reject = sifter.commands.reject:CommandReject',
64+
'ereject = sifter.commands.reject:CommandEReject',
6465
'require = sifter.commands.require:CommandRequire',
6566
'set = sifter.commands.variables:CommandSet',
6667
'stop = sifter.commands.stop:CommandStop',

sifter/commands/reject.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ def evaluate(self, message: Message, state: EvaluationState) -> Optional[Actions
2121
state.actions.append('reject', reject_message)
2222
state.actions.cancel_implicit_keep()
2323
return None
24+
25+
26+
class CommandEReject(CommandReject):
27+
28+
RULE_IDENTIFIER: Text = 'EREJECT'

sifter/extensions/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class ExtensionRegistry():
4242
'imap4flags',
4343
'regex',
4444
'reject',
45+
'ereject',
4546
'variables',
4647
]
4748

tests/evaluation_7.rules

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ require "reject";
22

33
#testcomment1
44

5-
if header "from" "coyote@desert.example.org" # testcomment2
6-
{
7-
reject text: # testcomment3
5+
if not header "from" "coyote@desert.example.org" { # testcomment2
6+
keep;
7+
} else {
8+
ereject text: # testcomment3
89
I do not accept messages from/* this is
910
not a comment */this address.
1011
..
1112
.
1213
;
13-
}
14+
}

0 commit comments

Comments
 (0)