snappymail/dev/Sieve/Extensions/rfc5463.js
2022-03-15 07:54:25 +01:00

64 lines
971 B
JavaScript

/**
* https://tools.ietf.org/html/rfc5463
*/
import {
GrammarCommand,
GrammarTest,
GrammarString,
GrammarStringList
} from 'Sieve/Grammar';
/**
* https://datatracker.ietf.org/doc/html/rfc5463#section-4
*/
export class IHaveTest extends GrammarTest
{
constructor()
{
super();
this.capabilities = new GrammarStringList;
}
get require() { return 'ihave'; }
toString()
{
return 'ihave ' + this.capabilities;
}
pushArguments(args)
{
let l = args.length;
if (args[l-1] instanceof GrammarString) {
this.method = args[l-1];
}
}
}
/**
* https://datatracker.ietf.org/doc/html/rfc5463#section-5
*/
export class ErrorCommand extends GrammarCommand
{
constructor()
{
super();
this.message = new GrammarString;
}
get require() { return 'ihave'; }
toString()
{
return 'error ' + this.message + ';';
}
pushArguments(args)
{
let l = args.length;
if (args[l-1] instanceof GrammarString) {
this.method = args[l-1];
}
}
}