mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Added Sieve parser code in master
This commit is contained in:
parent
e90e8a55ce
commit
f4cd25f8ad
21 changed files with 2126 additions and 8 deletions
47
dev/Sieve/Extensions/rfc5173.js
Normal file
47
dev/Sieve/Extensions/rfc5173.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5173
|
||||
*/
|
||||
|
||||
import {
|
||||
GrammarString,
|
||||
GrammarStringList,
|
||||
GrammarTest
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class BodyCommand extends GrammarTest
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.body_transform = ''; // :raw, :content <string-list>, :text
|
||||
this.key_list = new GrammarStringList;
|
||||
}
|
||||
|
||||
get require() { return 'body'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'body'
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.body_transform
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach((arg, i) => {
|
||||
if (':raw' === arg || ':text' === arg) {
|
||||
this.body_transform = arg;
|
||||
} else if (arg instanceof GrammarStringList || arg instanceof GrammarString) {
|
||||
if (':content' === args[i-1]) {
|
||||
this.body_transform = ':content ' + arg;
|
||||
} else {
|
||||
this[args[i+1] ? 'content_list' : 'key_list'] = arg;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Sieve.Commands.body = BodyCommand;
|
||||
Loading…
Add table
Add a link
Reference in a new issue