mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Added rfc6609
This commit is contained in:
parent
68fc9f21bd
commit
eb369ca122
2 changed files with 73 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* https://tools.ietf.org/html/rfc5230
|
* https://tools.ietf.org/html/rfc5230
|
||||||
|
* https://tools.ietf.org/html/rfc6131
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(Sieve => {
|
(Sieve => {
|
||||||
|
|
@ -12,6 +13,7 @@ class Vacation extends Grammar.Command
|
||||||
{
|
{
|
||||||
super('vacation');
|
super('vacation');
|
||||||
this._days = new Grammar.Number;
|
this._days = new Grammar.Number;
|
||||||
|
// this._seconds = new Grammar.Number;
|
||||||
this._subject = new Grammar.QuotedString;
|
this._subject = new Grammar.QuotedString;
|
||||||
this._from = new Grammar.QuotedString;
|
this._from = new Grammar.QuotedString;
|
||||||
this.addresses = new Grammar.StringList;
|
this.addresses = new Grammar.StringList;
|
||||||
|
|
@ -20,6 +22,7 @@ class Vacation extends Grammar.Command
|
||||||
this._reason = new Grammar.QuotedString; // QuotedString / MultiLine
|
this._reason = new Grammar.QuotedString; // QuotedString / MultiLine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get require() { return ['vacation','vacation-seconds']; }
|
||||||
get require() { return 'vacation'; }
|
get require() { return 'vacation'; }
|
||||||
|
|
||||||
toString()
|
toString()
|
||||||
|
|
@ -27,6 +30,8 @@ class Vacation extends Grammar.Command
|
||||||
let result = 'vacation';
|
let result = 'vacation';
|
||||||
if (0 < this._days.value) {
|
if (0 < this._days.value) {
|
||||||
result += ' :days ' + this._days;
|
result += ' :days ' + this._days;
|
||||||
|
// } else if (0 < this._seconds.value) {
|
||||||
|
// result += ' :seconds ' + this._seconds;
|
||||||
}
|
}
|
||||||
if (this._subject.length) {
|
if (this._subject.length) {
|
||||||
result += ' :subject ' + this._subject;
|
result += ' :subject ' + this._subject;
|
||||||
|
|
@ -46,14 +51,15 @@ class Vacation extends Grammar.Command
|
||||||
return result + ' ' + this._reason;
|
return result + ' ' + this._reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get days() { return this._days.value; }
|
get days() { return this._days.value; }
|
||||||
|
// get seconds() { return this._seconds.value; }
|
||||||
get subject() { return this._subject.value; }
|
get subject() { return this._subject.value; }
|
||||||
get from() { return this._from.value; }
|
get from() { return this._from.value; }
|
||||||
get handle() { return this._handle.value; }
|
get handle() { return this._handle.value; }
|
||||||
get reason() { return this._reason.value; }
|
get reason() { return this._reason.value; }
|
||||||
|
|
||||||
set days(int) { this._days.value = int; }
|
set days(int) { this._days.value = int; }
|
||||||
|
// set seconds(int) { this._seconds.value = int; }
|
||||||
set subject(str) { this._subject.value = str; }
|
set subject(str) { this._subject.value = str; }
|
||||||
set from(str) { this._from.value = str; }
|
set from(str) { this._from.value = str; }
|
||||||
set handle(str) { this._handle.value = str; }
|
set handle(str) { this._handle.value = str; }
|
||||||
|
|
@ -70,6 +76,9 @@ class Vacation extends Grammar.Command
|
||||||
case ':days':
|
case ':days':
|
||||||
this._days.value = arg.value; // Grammar.Number
|
this._days.value = arg.value; // Grammar.Number
|
||||||
break;
|
break;
|
||||||
|
// case ':seconds':
|
||||||
|
// this._seconds.value = arg.value; // Grammar.Number
|
||||||
|
// break;
|
||||||
case ':subject':
|
case ':subject':
|
||||||
this._subject.value = arg.value; // Grammar.QuotedString
|
this._subject.value = arg.value; // Grammar.QuotedString
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
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