mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Fix Sieve math-type and comparator handling
This commit is contained in:
parent
92a6027aa0
commit
3893849d21
12 changed files with 128 additions and 48 deletions
|
|
@ -119,18 +119,20 @@ export const parseScript = (script, name = 'script.sieve') => {
|
|||
let prev_arg = args[args.length-1];
|
||||
if (getMatchTypes(0).includes(arg)) {
|
||||
command.match_type = arg;
|
||||
} else if (':value' === prev_arg || ':count' === prev_arg) {
|
||||
// Sieve relational [RFC5231] match types
|
||||
/^(gt|ge|lt|le|eq|ne)$/.test(arg.value) || error('Invalid relational match-type ' + arg);
|
||||
command.match_type = prev_arg + ' ' + arg;
|
||||
} else if (getMatchTypes(0).includes(prev_arg)) {
|
||||
--args.length;
|
||||
// requires.push('relational');
|
||||
if (':value' === prev_arg || ':count' === prev_arg) {
|
||||
// Sieve relational [RFC5231] match types
|
||||
/^"(gt|ge|lt|le|eq|ne)"$/.test(arg) || error('Invalid relational match-type ' + arg);
|
||||
command.relational_match = arg;
|
||||
// requires.push('relational');
|
||||
return;
|
||||
}
|
||||
} else if (':comparator' === prev_arg) {
|
||||
command.comparator = arg;
|
||||
--args.length;
|
||||
} else {
|
||||
args.push(arg);
|
||||
}
|
||||
args.push(arg);
|
||||
},
|
||||
pushArgs = () => {
|
||||
if (args.length) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue