mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Fix Sieve QuotedString handling
This commit is contained in:
parent
257d9201f6
commit
61c2eefec1
13 changed files with 185 additions and 104 deletions
|
|
@ -14,10 +14,10 @@ export class DateTest extends TestCommand
|
|||
constructor()
|
||||
{
|
||||
super();
|
||||
this.zone = new GrammarQuotedString;
|
||||
this._zone = new GrammarQuotedString;
|
||||
this.originalzone = false;
|
||||
this.header_name = new GrammarQuotedString;
|
||||
this.date_part = new GrammarQuotedString;
|
||||
this._header_name = new GrammarQuotedString;
|
||||
this._date_part = new GrammarQuotedString;
|
||||
this.key_list = new GrammarStringList;
|
||||
// rfc5260#section-6
|
||||
this.index = new GrammarNumber;
|
||||
|
|
@ -27,30 +27,39 @@ export class DateTest extends TestCommand
|
|||
// get require() { return ['date','index']; }
|
||||
get require() { return 'date'; }
|
||||
|
||||
get zone() { return this._zone.value; }
|
||||
set zone(v) { this._zone.value = v; }
|
||||
|
||||
get header_name() { return this._header_name.value; }
|
||||
set header_name(v) { this._header_name.value = v; }
|
||||
|
||||
get date_part() { return this._date_part.value; }
|
||||
set date_part(v) { this._date_part.value = v; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'date'
|
||||
+ (this.last ? ' :last' : (this.index.value ? ' :index ' + this.index : ''))
|
||||
+ (this.originalzone ? ' :originalzone' : (this.zone.length ? ' :zone ' + this.zone : ''))
|
||||
+ (this.originalzone ? ' :originalzone' : (this._zone.length ? ' :zone ' + this._zone : ''))
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.header_name
|
||||
+ ' ' + this.date_part
|
||||
+ ' ' + this._header_name
|
||||
+ ' ' + this._date_part
|
||||
+ ' ' + this.key_list;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.key_list = args.pop();
|
||||
this.date_part = args.pop();
|
||||
this.header_name = args.pop();
|
||||
this._date_part = args.pop();
|
||||
this._header_name = args.pop();
|
||||
args.forEach((arg, i) => {
|
||||
if (':originalzone' === arg) {
|
||||
this.originalzone = true;
|
||||
} else if (':last' === arg) {
|
||||
this.last = true;
|
||||
} else if (i && ':zone' === args[i-1]) {
|
||||
this.zone.value = arg.value;
|
||||
this._zone.value = arg.value;
|
||||
} else if (i && ':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
}
|
||||
|
|
@ -63,30 +72,36 @@ export class CurrentDateTest extends TestCommand
|
|||
constructor()
|
||||
{
|
||||
super();
|
||||
this.zone = new GrammarQuotedString;
|
||||
this.date_part = new GrammarQuotedString;
|
||||
this._zone = new GrammarQuotedString;
|
||||
this._date_part = new GrammarQuotedString;
|
||||
this.key_list = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'date'; }
|
||||
|
||||
get zone() { return this._zone.value; }
|
||||
set zone(v) { this._zone.value = v; }
|
||||
|
||||
get date_part() { return this._date_part.value; }
|
||||
set date_part(v) { this._date_part.value = v; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'currentdate'
|
||||
+ (this.zone.length ? ' :zone ' + this.zone : '')
|
||||
+ (this._zone.length ? ' :zone ' + this._zone : '')
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.date_part
|
||||
+ ' ' + this._date_part
|
||||
+ ' ' + this.key_list;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.key_list = args.pop();
|
||||
this.date_part = args.pop();
|
||||
this._date_part = args.pop();
|
||||
args.forEach((arg, i) => {
|
||||
if (i && ':zone' === args[i-1]) {
|
||||
this.zone.value = arg.value;
|
||||
this._zone.value = arg.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue