Some Sieve parser improvements

This commit is contained in:
the-djmaze 2024-09-23 16:50:52 +02:00
parent 61c2eefec1
commit 4022d39f76
7 changed files with 32 additions and 18 deletions

View file

@ -48,6 +48,7 @@ import { NotifyCommand, ValidNotifyMethodTest, NotifyMethodCapabilityTest } from
import { IHaveTest, ErrorCommand } from 'Sieve/Extensions/rfc5463';
import { MailboxExistsTest, MetadataTest, MetadataExistsTest } from 'Sieve/Extensions/rfc5490';
import { ForEveryPartCommand, BreakCommand, ReplaceCommand, EncloseCommand, ExtractTextCommand } from 'Sieve/Extensions/rfc5703';
import { ValidExtListTest } from 'Sieve/Extensions/rfc6134';
import { IncludeCommand, ReturnCommand, GlobalCommand } from 'Sieve/Extensions/rfc6609';
export const
@ -127,6 +128,8 @@ export const
ReplaceCommand,
EncloseCommand,
ExtractTextCommand,
// rfc6134
ValidExtListTest,
// rfc6609
IncludeCommand,
ReturnCommand,
@ -144,6 +147,17 @@ export const
return commands;
},
unavailableCommands = () => {
let commands = {};
AllCommands.forEach(cmd => {
const obj = new cmd, requires = obj.require;
if (requires && !(Array.isArray(requires) ? requires : [requires]).every(string => capa.includes(string))) {
commands[obj.identifier] = cmd;
}
});
return commands;
},
availableActions = () => {
let actions = {}, id;
AllCommands.forEach(cmd => {