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

@ -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;
}