mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 07:57:02 +03:00
Activate more Sieve extensions and use parseScript when saving script
This commit is contained in:
parent
58f5e90f8f
commit
40adf992ed
9 changed files with 39 additions and 38 deletions
|
|
@ -43,5 +43,3 @@ export class BodyCommand extends GrammarTest
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sieve.Commands.body = BodyCommand;
|
|
||||||
|
|
|
||||||
|
|
@ -34,5 +34,3 @@ export class EnvironmentCommand extends GrammarTest
|
||||||
this.key_list = args[args.length-1];
|
this.key_list = args[args.length-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sieve.Commands.environment = EnvironmentCommand;
|
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,3 @@ export class StringCommand extends GrammarTest
|
||||||
this.key_list = args[args.length-1];
|
this.key_list = args[args.length-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Object.assign(Sieve.Commands, {
|
|
||||||
set: SetCommand,
|
|
||||||
string: StringCommand
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,3 @@ export class VirusTestCommand extends GrammarTest
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Object.assign(Sieve.Commands, {
|
|
||||||
spamtest: SpamTestCommand,
|
|
||||||
virustest: VirusTestCommand
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export class CurrentDateCommand extends GrammarTest
|
||||||
{
|
{
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
super('date');
|
super();
|
||||||
this.zone = new GrammarQuotedString;
|
this.zone = new GrammarQuotedString;
|
||||||
this.date_part = new GrammarQuotedString;
|
this.date_part = new GrammarQuotedString;
|
||||||
this.key_list = new GrammarStringList;
|
this.key_list = new GrammarStringList;
|
||||||
|
|
@ -76,7 +76,7 @@ export class CurrentDateCommand extends GrammarTest
|
||||||
|
|
||||||
toString()
|
toString()
|
||||||
{
|
{
|
||||||
return 'date'
|
return 'currentdate'
|
||||||
+ (this.zone.length ? ' :zone ' + this.zone : '')
|
+ (this.zone.length ? ' :zone ' + this.zone : '')
|
||||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||||
+ ' ' + this.match_type
|
+ ' ' + this.match_type
|
||||||
|
|
@ -98,9 +98,3 @@ export class CurrentDateCommand extends GrammarTest
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Object.assign(Sieve.Commands, {
|
|
||||||
date: DateTestCommand,
|
|
||||||
currentdate: CurrentDateCommand
|
|
||||||
*/
|
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,3 @@ export class DeleteHeaderCommand extends GrammarCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
Object.assign(Sieve.Commands, {
|
|
||||||
addheader: AddHeaderCommand,
|
|
||||||
deleteheader: DeleteHeaderCommand
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,10 @@ import {
|
||||||
TrueCommand
|
TrueCommand
|
||||||
} from 'Sieve/Tests';
|
} from 'Sieve/Tests';
|
||||||
|
|
||||||
import {
|
import { BodyCommand } from 'Sieve/Extensions/rfc5173';
|
||||||
VacationCommand
|
import { EnvironmentCommand } from 'Sieve/Extensions/rfc5183';
|
||||||
} from 'Sieve/Extensions/rfc5230';
|
import { SetCommand, StringCommand } from 'Sieve/Extensions/rfc5229';
|
||||||
|
import { VacationCommand } from 'Sieve/Extensions/rfc5230';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SetFlagCommand,
|
SetFlagCommand,
|
||||||
|
|
@ -62,6 +63,10 @@ import {
|
||||||
HasFlagCommand
|
HasFlagCommand
|
||||||
} from 'Sieve/Extensions/rfc5232';
|
} from 'Sieve/Extensions/rfc5232';
|
||||||
|
|
||||||
|
import { SpamTestCommand, VirusTestCommand } from 'Sieve/Extensions/rfc5235';
|
||||||
|
import { DateCommand, CurrentDateCommand } from 'Sieve/Extensions/rfc5260';
|
||||||
|
import { AddHeaderCommand, DeleteHeaderCommand } from 'Sieve/Extensions/rfc5293';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ErejectCommand,
|
ErejectCommand,
|
||||||
RejectCommand
|
RejectCommand
|
||||||
|
|
@ -97,6 +102,13 @@ const
|
||||||
not: NotCommand,
|
not: NotCommand,
|
||||||
size: SizeCommand,
|
size: SizeCommand,
|
||||||
true: TrueCommand,
|
true: TrueCommand,
|
||||||
|
// rfc5173
|
||||||
|
body: BodyCommand,
|
||||||
|
// rfc5183
|
||||||
|
environment: EnvironmentCommand,
|
||||||
|
// rfc5229
|
||||||
|
set: SetCommand,
|
||||||
|
string: StringCommand,
|
||||||
// rfc5230
|
// rfc5230
|
||||||
vacation: VacationCommand,
|
vacation: VacationCommand,
|
||||||
// rfc5232
|
// rfc5232
|
||||||
|
|
@ -104,6 +116,15 @@ const
|
||||||
addflag: AddFlagCommand,
|
addflag: AddFlagCommand,
|
||||||
removeflag: RemoveFlagCommand,
|
removeflag: RemoveFlagCommand,
|
||||||
hasflag: HasFlagCommand,
|
hasflag: HasFlagCommand,
|
||||||
|
// rfc5235
|
||||||
|
spamtest: SpamTestCommand,
|
||||||
|
virustest: VirusTestCommand,
|
||||||
|
// rfc5260
|
||||||
|
date: DateCommand,
|
||||||
|
currentdate: CurrentDateCommand,
|
||||||
|
// rfc5293
|
||||||
|
AddHeaderCommand,
|
||||||
|
DeleteHeaderCommand,
|
||||||
// rfc5429
|
// rfc5429
|
||||||
ereject: ErejectCommand,
|
ereject: ErejectCommand,
|
||||||
reject: RejectCommand,
|
reject: RejectCommand,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ export class SieveScriptPopupView extends rl.pluginPopupView {
|
||||||
let self = this,
|
let self = this,
|
||||||
script = self.script();
|
script = self.script();
|
||||||
if (!self.saving/* && script.hasChanges()*/) {
|
if (!self.saving/* && script.hasChanges()*/) {
|
||||||
|
this.errorText('');
|
||||||
|
self.saveError(false);
|
||||||
|
|
||||||
if (!script.verify()) {
|
if (!script.verify()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -52,9 +55,14 @@ export class SieveScriptPopupView extends rl.pluginPopupView {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
parseScript(this.script().body());
|
||||||
|
} catch (e) {
|
||||||
|
this.errorText(e.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self.saving = true;
|
self.saving = true;
|
||||||
self.saveError(false);
|
|
||||||
self.errorText('');
|
|
||||||
|
|
||||||
if (self.allowToggle()) {
|
if (self.allowToggle()) {
|
||||||
script.body(script.filtersToRaw());
|
script.body(script.filtersToRaw());
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,11 @@
|
||||||
<a class="btn" data-bind="visible: $root.allowToggle, click: function() { $root.toggleFiltersRaw(); }, css: {'active': $root.rawActive }" data-i18n="[title]POPUPS_SIEVE_SCRIPT/BUTTON_RAW_SCRIPT">
|
<a class="btn" data-bind="visible: $root.allowToggle, click: function() { $root.toggleFiltersRaw(); }, css: {'active': $root.rawActive }" data-i18n="[title]POPUPS_SIEVE_SCRIPT/BUTTON_RAW_SCRIPT">
|
||||||
<i class="icon-file-code"></i>
|
<i class="icon-file-code"></i>
|
||||||
</a>
|
</a>
|
||||||
|
<!--
|
||||||
<a class="btn" data-bind="visible: $root.rawActive, click: function() { $root.validateScript(); }">
|
<a class="btn" data-bind="visible: $root.rawActive, click: function() { $root.validateScript(); }">
|
||||||
Validate
|
<span data-i18n="POPUPS_SIEVE_SCRIPT/VALIDATE"></span>
|
||||||
</a>
|
</a>
|
||||||
|
-->
|
||||||
<a class="btn buttonSave" data-bind="visible: hasChanges, click: function() { $root.saveScript(); }, css: {'btn-danger': $root.saveError}">
|
<a class="btn buttonSave" data-bind="visible: hasChanges, click: function() { $root.saveScript(); }, css: {'btn-danger': $root.saveError}">
|
||||||
<i class="fontastic" data-bind="css: {'icon-spinner': $root.saving}">💾</i>
|
<i class="fontastic" data-bind="css: {'icon-spinner': $root.saving}">💾</i>
|
||||||
<span data-i18n="GLOBAL/SAVE"></span>
|
<span data-i18n="GLOBAL/SAVE"></span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue