Added Sieve extension rfc5463

This commit is contained in:
the-djmaze 2022-03-15 07:54:25 +01:00
parent c76823dc5f
commit c01c02d723
3 changed files with 72 additions and 17 deletions

View file

@ -0,0 +1,64 @@
/**
* 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];
}
}
}

View file

@ -68,22 +68,10 @@ import {
import { SpamTestTest, VirusTestTest } from 'Sieve/Extensions/rfc5235';
import { DateTest, CurrentDateTest } from 'Sieve/Extensions/rfc5260';
import { AddHeaderCommand, DeleteHeaderCommand } from 'Sieve/Extensions/rfc5293';
import {
ErejectCommand,
RejectCommand
} from 'Sieve/Extensions/rfc5429';
import {
MailboxExistsTest,
MetadataTest,
MetadataExistsTest
} from 'Sieve/Extensions/rfc5490';
import {
IncludeCommand,
ReturnCommand
} from 'Sieve/Extensions/rfc6609';
import { ErejectCommand, RejectCommand } from 'Sieve/Extensions/rfc5429';
import { IHaveTest, ErrorCommand } from 'Sieve/Extensions/rfc5463';
import { MailboxExistsTest, MetadataTest, MetadataExistsTest } from 'Sieve/Extensions/rfc5490';
import { IncludeCommand, ReturnCommand } from 'Sieve/Extensions/rfc6609';
const
AllCommands = {
@ -136,6 +124,9 @@ const
// rfc5429
ereject: ErejectCommand,
reject: RejectCommand,
// rfc5463
ihave: IHaveTest,
error: ErrorCommand,
// rfc5490
mailboxexists: MailboxExistsTest,
metadata: MetadataTest,

View file

@ -17,7 +17,7 @@ https://www.iana.org/assignments/sieve-extensions/sieve-extensions.xhtml
- [x] RFC5293 editheader
- [x] RFC5429 ereject / reject
- [ ] RFC5435 enotify
- [ ] RFC5463 ihave
- [x] RFC5463 ihave
- [x] RFC5490 mailbox / mboxmetadata / servermetadata
- [ ] RFC5703 enclose / extracttext / foreverypart / mime / replace
- [ ] RFC6131 vacation-seconds