snappymail/dev/Sieve/Extensions/rfc5463.js

59 lines
848 B
JavaScript
Raw Normal View History

2022-03-15 14:54:25 +08:00
/**
* https://tools.ietf.org/html/rfc5463
*/
import {
ControlCommand,
TestCommand,
2022-03-15 16:58:04 +08:00
GrammarQuotedString,
2022-03-15 14:54:25 +08:00
GrammarStringList
} from 'Sieve/Grammar';
/**
* https://datatracker.ietf.org/doc/html/rfc5463#section-4
*/
export class IHaveTest extends TestCommand
2022-03-15 14:54:25 +08:00
{
constructor()
{
super();
this.capabilities = new GrammarStringList;
}
get require() { return 'ihave'; }
toString()
{
return 'ihave ' + this.capabilities;
}
pushArguments(args)
{
2022-03-15 16:58:04 +08:00
this.capabilities = args.pop();
2022-03-15 14:54:25 +08:00
}
}
/**
* https://datatracker.ietf.org/doc/html/rfc5463#section-5
*/
export class ErrorCommand extends ControlCommand
2022-03-15 14:54:25 +08:00
{
constructor()
{
super();
2022-03-15 16:58:04 +08:00
this.message = new GrammarQuotedString;
2022-03-15 14:54:25 +08:00
}
get require() { return 'ihave'; }
toString()
{
return 'error ' + this.message + ';';
}
pushArguments(args)
{
2022-03-15 16:58:04 +08:00
this.message = args.pop();
2022-03-15 14:54:25 +08:00
}
}