Fix Sieve math-type and comparator handling

This commit is contained in:
djmaze 2024-09-24 11:44:40 +02:00
parent 92a6027aa0
commit 3893849d21
12 changed files with 128 additions and 48 deletions

View file

@ -22,8 +22,9 @@ export class BodyTest extends TestCommand
toString()
{
return 'body'
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this.match_type
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ ' ' + this.body_transform
+ ' ' + this.key_list;
}

View file

@ -25,8 +25,9 @@ export class EnvironmentTest extends TestCommand
toString()
{
return 'environment'
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this.match_type
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ ' ' + this._name
+ ' ' + this.key_list;
}

View file

@ -57,8 +57,9 @@ export class StringTest extends TestCommand
toString()
{
return 'string'
+ ' ' + this.match_type
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ ' ' + this.source
+ ' ' + this.key_list;
}

View file

@ -79,8 +79,9 @@ export class HasFlagTest extends TestCommand
toString()
{
return 'hasflag'
+ ' ' + this.match_type
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ ' ' + this.variable_list
+ ' ' + this.list_of_flags;
}

View file

@ -17,7 +17,7 @@ export class SpamTestTest extends TestCommand
}
// get require() { return this.percent ? 'spamtestplus' : 'spamtest'; }
get require() { return /:value|:count/.test(this.match_type) ? ['spamtestplus','relational'] : 'spamtestplus'; }
get require() { return /:value|:count/.test(this._match_type) ? ['spamtestplus','relational'] : 'spamtestplus'; }
get value() { return this._value.value; }
set value(v) { this._value.value = v; }
@ -26,8 +26,9 @@ export class SpamTestTest extends TestCommand
{
return 'spamtest'
+ (this.percent ? ' :percent' : '')
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this.match_type
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ ' ' + this._value;
}
@ -51,7 +52,7 @@ export class VirusTestTest extends TestCommand
this._value = new GrammarQuotedString; // 1 - 5
}
get require() { return /:value/.test(this.match_type) ? ['virustest','relational'] : 'virustest'; }
get require() { return ':value' == this._match_type ? ['virustest','relational'] : 'virustest'; }
get value() { return this._value.value; }
set value(v) { this._value.value = v; }
@ -59,8 +60,9 @@ export class VirusTestTest extends TestCommand
toString()
{
return 'virustest'
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this.match_type
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ ' ' + this._value;
}

View file

@ -41,8 +41,9 @@ export class DateTest extends TestCommand
return 'date'
+ (this.last ? ' :last' : (this.index.value ? ' :index ' + this.index : ''))
+ (this.originalzone ? ' :originalzone' : (this._zone.length ? ' :zone ' + this._zone : ''))
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this.match_type
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ ' ' + this._header_name
+ ' ' + this._date_part
+ ' ' + this.key_list;
@ -89,8 +90,9 @@ export class CurrentDateTest extends TestCommand
{
return 'currentdate'
+ (this._zone.length ? ' :zone ' + this._zone : '')
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this.match_type
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ ' ' + this._date_part
+ ' ' + this.key_list;
}

View file

@ -116,8 +116,9 @@ export class NotifyMethodCapabilityTest extends TestCommand
toString()
{
return 'valid_notify_method '
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ (this.match_type ? ' ' + this.match_type : '')
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ (this._match_type ? ' ' + this._match_type : '')
+ (this.relational_match ? ' ' + this.relational_match : '')
+ this._notification_uri
+ this._notification_capability
+ this.key_list;

View file

@ -58,8 +58,9 @@ export class MetadataTest extends TestCommand
toString()
{
return 'metadata '
+ ' ' + this.match_type
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this._match_type
+ (this.relational_match ? ' ' + this.relational_match : '')
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ ' ' + this._mailbox
+ ' ' + this._annotation_name
+ ' ' + this.key_list;
@ -124,8 +125,9 @@ export class ServerMetadataTest extends TestCommand
toString()
{
return 'servermetadata '
+ ' ' + this.match_type
+ (this.comparator ? ' :comparator ' + this.comparator : '')
+ ' ' + this._match_type
+ (this.relational_match ? ' ' + this.relational_match : '')
+ (this._comparator ? ' :comparator ' + this._comparator : '')
+ ' ' + this._annotation_name
+ ' ' + this.key_list;
}