mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Added rfc6609
This commit is contained in:
parent
68fc9f21bd
commit
eb369ca122
2 changed files with 73 additions and 1 deletions
63
dev/Sieve/Extensions/rfc6609.js
Normal file
63
dev/Sieve/Extensions/rfc6609.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc6609
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Include extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('include');
|
||||
this.global = false; // ':personal' / ':global';
|
||||
this.once = false;
|
||||
this.optional = false;
|
||||
this.value = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'include'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return this.identifier
|
||||
+ (this.global ? ' :global' : '')
|
||||
+ (this.once ? ' :once' : '')
|
||||
+ (this.optional ? ' :optional' : '')
|
||||
+ ' ' + this.value + ';';
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach(arg => {
|
||||
if (':global' === arg || ':once' === arg || ':optional' === arg) {
|
||||
this[arg.substr(1)] = true;
|
||||
} else if (arg instanceof Grammar.QuotedString) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Return extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('return');
|
||||
}
|
||||
|
||||
get require() { return 'include'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'return;';
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(Sieve.Commands, {
|
||||
include: Include,
|
||||
return: Return
|
||||
});
|
||||
|
||||
})(this.Sieve);
|
||||
Loading…
Add table
Add a link
Reference in a new issue