Added some draft templates for Sieve GUI

This commit is contained in:
the-djmaze 2024-09-22 16:36:12 +02:00
parent 04f3133f27
commit 74a67aabaf
42 changed files with 542 additions and 101 deletions

View file

@ -21,6 +21,10 @@ export class FileIntoCommand extends ActionCommand
super();
// QuotedString / MultiLine
this._mailbox = new GrammarQuotedString();
// https://datatracker.ietf.org/doc/html/rfc3894
// this.copy = false;
// https://datatracker.ietf.org/doc/html/rfc5490#section-3.2
// this.create = false;
}
get require() { return 'fileinto'; }
@ -28,9 +32,7 @@ export class FileIntoCommand extends ActionCommand
toString()
{
return 'fileinto'
// https://datatracker.ietf.org/doc/html/rfc3894
+ ((this.copy && capa.includes('copy')) ? ' :copy' : '')
// https://datatracker.ietf.org/doc/html/rfc5490#section-3.2
+ ((this.create && capa.includes('mailbox')) ? ' :create' : '')
+ ' ' + this._mailbox
+ ';';
@ -64,15 +66,17 @@ export class RedirectCommand extends ActionCommand
super();
// QuotedString / MultiLine
this._address = new GrammarQuotedString();
// https://datatracker.ietf.org/doc/html/rfc3894
// this.copy = false;
// https://datatracker.ietf.org/doc/html/rfc6134#section-2.3
// this.list = null;
}
toString()
{
return 'redirect'
// https://datatracker.ietf.org/doc/html/rfc6134#section-2.3
// + ((this.list && capa.includes('extlists')) ? ' :list ' + this.list : '')
// https://datatracker.ietf.org/doc/html/rfc3894
+ ((this.copy && capa.includes('copy')) ? ' :copy' : '')
+ ' ' + this._address
+ ';';

View file

@ -5,6 +5,7 @@
import {
ControlCommand,
GrammarCommands,
GrammarStringList,
GrammarQuotedString
} from 'Sieve/Grammar';
@ -16,37 +17,55 @@ import {
* elsif <test2: test> <block2: block>
* else <block3: block>
*/
export class ConditionalCommand extends ControlCommand
export /*abstract*/ class ConditionalCommand extends ControlCommand
{
constructor(identifier)
constructor()
{
super(identifier);
this.test = null;
}
toString()
{
return this.identifier + ' ' + this.test + ' ' + this.commands;
}
/*
public function pushArguments(array $args): void
{
args.forEach((arg, i) => {
if (i && ':' === args[i-1][0]) {
this[args[i-1].replace(':','_')].value = arg.value;
}
});
print_r($args);
exit;
}
if (this.constructor == ConditionalCommand) {
throw Error("Abstract class can't be instantiated.");
}
*/
super();
this.commands = new GrammarCommands;
}
}
export class IfCommand extends ConditionalCommand
{
constructor()
{
super();
this._test = null; // must be descendent instanceof TestCommand
}
get test()
{
return this._test;
}
set test(value)
{
/*
if (!value instanceof TestCommand) {
throw Error("test must be descendent instanceof TestCommand.");
}
*/
this._test = value;
}
toString()
{
/*
if (!this._test instanceof TestCommand) {
throw Error("test must be descendent instanceof TestCommand.");
}
*/
return this.identifier + ' ' + this._test + ' ' + this.commands;
}
}
export class ElsIfCommand extends ConditionalCommand
export class ElsIfCommand extends IfCommand
{
}

View file

@ -316,11 +316,6 @@ export class NotTest extends TestCommand
{
return 'not ' + this.test;
}
pushArguments()
{
throw 'No arguments';
}
}
/**