mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Added Sieve rfc5490
Renamed tests classes *Command as *Test
This commit is contained in:
parent
40adf992ed
commit
668a5f1fa5
12 changed files with 224 additions and 57 deletions
|
|
@ -8,7 +8,7 @@ import {
|
|||
GrammarTest
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class BodyCommand extends GrammarTest
|
||||
export class BodyTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
GrammarTest
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class EnvironmentCommand extends GrammarTest
|
||||
export class EnvironmentTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export class SetCommand extends GrammarCommand
|
|||
}
|
||||
}
|
||||
|
||||
export class StringCommand extends GrammarTest
|
||||
export class StringTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export class RemoveFlagCommand extends FlagCommand
|
|||
{
|
||||
}
|
||||
|
||||
export class HasFlagCommand extends GrammarTest
|
||||
export class HasFlagTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
GrammarTest
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class SpamTestCommand extends GrammarTest
|
||||
export class SpamTestTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
@ -41,7 +41,7 @@ export class SpamTestCommand extends GrammarTest
|
|||
}
|
||||
}
|
||||
|
||||
export class VirusTestCommand extends GrammarTest
|
||||
export class VirusTestTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
GrammarTest
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class DateCommand extends GrammarTest
|
||||
export class DateTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
@ -62,7 +62,7 @@ export class DateCommand extends GrammarTest
|
|||
}
|
||||
}
|
||||
|
||||
export class CurrentDateCommand extends GrammarTest
|
||||
export class CurrentDateTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
|
|
|
|||
151
dev/Sieve/Extensions/rfc5490.js
Normal file
151
dev/Sieve/Extensions/rfc5490.js
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5490
|
||||
*/
|
||||
|
||||
import {
|
||||
GrammarTest,
|
||||
GrammarString,
|
||||
GrammarStringList
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
/**
|
||||
* https://datatracker.ietf.org/doc/html/rfc5490#section-3.1
|
||||
*/
|
||||
export class MailboxExistsTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.mailbox_names = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'mailbox'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'mailboxexists ' + this.mailbox_names + ';';
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
if (args[0] instanceof GrammarStringList) {
|
||||
this.mailbox_names = args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* https://datatracker.ietf.org/doc/html/rfc5490#section-3.3
|
||||
*/
|
||||
export class MetadataTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.mailbox = new GrammarString;
|
||||
this.annotation_name = new GrammarString;
|
||||
this.key_list = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'mboxmetadata'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'metadata '
|
||||
+ ' ' + this.match_type
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.mailbox
|
||||
+ ' ' + this.annotation_name
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.mailbox = args[args.length-3];
|
||||
this.annotation_name = args[args.length-2];
|
||||
this.key_list = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* https://datatracker.ietf.org/doc/html/rfc5490#section-3.4
|
||||
*/
|
||||
export class MetadataExistsTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.mailbox = new GrammarString;
|
||||
this.annotation_names = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'mboxmetadata'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'metadataexists '
|
||||
+ ' ' + this.mailbox
|
||||
+ ' ' + this.annotation_names;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.mailbox = args[args.length-2];
|
||||
this.annotation_names = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* https://datatracker.ietf.org/doc/html/rfc5490#section-3.3
|
||||
*/
|
||||
export class ServerMetadataTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.annotation_name = new GrammarString;
|
||||
this.key_list = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'servermetadata'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'servermetadata '
|
||||
+ ' ' + this.match_type
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.annotation_name
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.annotation_name = args[args.length-2];
|
||||
this.key_list = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* https://datatracker.ietf.org/doc/html/rfc5490#section-3.4
|
||||
*/
|
||||
export class ServerMetadataExistsTest extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.annotation_names = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'servermetadata'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'servermetadataexists '
|
||||
+ ' ' + this.annotation_names;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.annotation_names = args[args.length-1];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue