mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Added rfc5183, rfc5229, rfc5260 and rfc5293
Make comparator and match_type available for all Test classes Signed-off-by: djmaze <djmaze@djmaze.lan>
This commit is contained in:
parent
3ce123b536
commit
3566f4a538
9 changed files with 325 additions and 14 deletions
73
dev/Sieve/Extensions/rfc5229.js
Normal file
73
dev/Sieve/Extensions/rfc5229.js
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5229
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Set extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('set');
|
||||
this.modifiers = [];
|
||||
this._name = new Grammar.QuotedString;
|
||||
this._value = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'variables'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'set'
|
||||
+ ' ' + this.modifiers.join(' ')
|
||||
+ ' ' + this._name
|
||||
+ ' ' + this._value;
|
||||
}
|
||||
|
||||
get name() { return this._name.value; }
|
||||
set name(str) { this._name.value = str; }
|
||||
|
||||
get value() { return this._value.value; }
|
||||
set value(str) { this._value.value = str; }
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
[':lower', ':upper', ':lowerfirst', ':upperfirst', ':quotewildcard', ':length'].forEach(modifier => {
|
||||
args.includes(modifier) && this.modifiers.push(modifier);
|
||||
});
|
||||
this._name = args[args.length-2];
|
||||
this._value = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
class String extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('string');
|
||||
this.source = new Grammar.StringList;
|
||||
this.key_list = new Grammar.StringList;
|
||||
}
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'string'
|
||||
+ ' ' + this.match_type
|
||||
// + ' ' + this.comparator
|
||||
+ ' ' + this.source
|
||||
+ ' ' + this.key_list;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.source = args[args.length-2];
|
||||
this.key_list = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.set = Set;
|
||||
Sieve.Commands.string = String;
|
||||
|
||||
})(this.Sieve);
|
||||
Loading…
Add table
Add a link
Reference in a new issue