Get most valid Sieve scripts parsed properly

This commit is contained in:
the-djmaze 2024-09-24 01:37:04 +02:00
parent c254025d7a
commit 76ade5eac0
25 changed files with 175 additions and 71 deletions

View file

@ -58,13 +58,45 @@ export const
serverErrorDesc(text);
},
getComparators = () => ['i;ascii-casemap'],
koObserve = (obj, prop) => {
// Object.getOwnPropertyNames(obj).forEach(prop => {
// prop = prop.replace(/^_/, '');
obj['ko_' + prop] = ko.computed({
read: () => obj[prop],
write: (v) => obj[prop] = v,
pure:true
});
// });
// Object.preventExtensions(obj);
},
getComparators = (validOnly = 0) => {
let result = [
// Default
'i;ascii-casemap',
];
if (capa.includes('relational') || !validOnly) {
result.push('i;octet');
}
if (capa.includes('comparator-i;ascii-numeric') || !validOnly) {
result.push('i;ascii-numeric');
}
if (capa.includes('comparator-i;unicode-casemap') || !validOnly) {
result.push('i;unicode-casemap');
}
return result;
},
getMatchTypes = (validOnly = 1) => {
let result = [':is',':contains',':matches'];
// https://datatracker.ietf.org/doc/html/rfc6134#section-2.3
// Only available for tests with a key_list property
if (capa.includes('extlists') || !validOnly) {
result.push(':list');
}
if (capa.includes('relational') || !validOnly) {
result.push(':value');
result.push(':count');
}
return result;
};