mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Added Sieve parser code in master
This commit is contained in:
parent
e90e8a55ce
commit
f4cd25f8ad
21 changed files with 2126 additions and 8 deletions
77
dev/Sieve/Extensions/rfc5235.js
Normal file
77
dev/Sieve/Extensions/rfc5235.js
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5235
|
||||
*/
|
||||
|
||||
import {
|
||||
GrammarQuotedString,
|
||||
GrammarString,
|
||||
GrammarTest
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class SpamTestCommand extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.percent = false, // 0 - 100 else 0 - 10
|
||||
this.value = new GrammarQuotedString;
|
||||
}
|
||||
|
||||
// get require() { return this.percent ? 'spamtestplus' : 'spamtest'; }
|
||||
get require() { return /:value|:count/.test(this.match_type) ? ['spamtestplus','relational'] : 'spamtestplus'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'spamtest'
|
||||
+ (this.percent ? ' :percent' : '')
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach(arg => {
|
||||
if (':percent' === arg) {
|
||||
this.percent = true;
|
||||
} else if (arg instanceof GrammarString) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class VirusTestCommand extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.value = new GrammarQuotedString; // 1 - 5
|
||||
}
|
||||
|
||||
get require() { return /:value|:count/.test(this.match_type) ? ['virustest','relational'] : 'virustest'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'virustest'
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach(arg => {
|
||||
if (arg instanceof GrammarString) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Object.assign(Sieve.Commands, {
|
||||
spamtest: SpamTestCommand,
|
||||
virustest: VirusTestCommand
|
||||
});
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue