Skip to content
Snippets Groups Projects
Commit 62efe088 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

imapflags: Added (dummy) check for the existance of the variables extension.

parent 4e603ce4
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,8 @@ bool ext_imapflags_command_validate ...@@ -37,6 +37,8 @@ bool ext_imapflags_command_validate
arg2 = sieve_ast_argument_next(arg); arg2 = sieve_ast_argument_next(arg);
if ( arg2 != NULL ) { if ( arg2 != NULL ) {
/* First check syntax sanity */
if ( sieve_ast_argument_type(arg) != SAAT_STRING ) if ( sieve_ast_argument_type(arg) != SAAT_STRING )
{ {
sieve_command_validate_error(validator, cmd, sieve_command_validate_error(validator, cmd,
...@@ -45,7 +47,7 @@ bool ext_imapflags_command_validate ...@@ -45,7 +47,7 @@ bool ext_imapflags_command_validate
cmd->command->identifier, sieve_ast_argument_name(arg)); cmd->command->identifier, sieve_ast_argument_name(arg));
return FALSE; return FALSE;
} }
if ( sieve_ast_argument_type(arg2) != SAAT_STRING && if ( sieve_ast_argument_type(arg2) != SAAT_STRING &&
sieve_ast_argument_type(arg2) != SAAT_STRING_LIST ) sieve_ast_argument_type(arg2) != SAAT_STRING_LIST )
{ {
...@@ -56,7 +58,19 @@ bool ext_imapflags_command_validate ...@@ -56,7 +58,19 @@ bool ext_imapflags_command_validate
cmd->command->identifier, sieve_ast_argument_name(arg2)); cmd->command->identifier, sieve_ast_argument_name(arg2));
return FALSE; return FALSE;
} }
//sieve_validator_argument_activate(validator, arg);
/* Then check whether the second argument is permitted */
/* IF !VARIABLE EXTENSION LOADED */
{
sieve_command_validate_error(validator, cmd,
"the %s command only allows for the specification of a "
"variable name when the variables extension is active",
cmd->command->identifier);
return FALSE;
}
//sieve_validator_argument_activate(validator, arg2);
} }
return TRUE; return TRUE;
} }
......
...@@ -2,15 +2,15 @@ require "imapflags"; ...@@ -2,15 +2,15 @@ require "imapflags";
require "fileinto"; require "fileinto";
if header :contains "from" "boss@frobnitzm.example.edu" { if header :contains "from" "boss@frobnitzm.example.edu" {
setflag "flagvar" "\\Flagged"; setflag "\\Flagged";
# fileinto :flags "${flagvar}" "INBOX.From Boss"; fileinto "INBOX.From Boss";
} }
if header :contains "Disposition-Notification-To" "mel@example.com" { if header :contains "Disposition-Notification-To" "mel@example.com" {
addflag "flagvar" "$MDNRequired"; addflag "$MDNRequired";
} }
if header :contains "from" "imap@cac.washington.example.edu" { if header :contains "from" "imap@cac.washington.example.edu" {
removeflag "flagvar" "$MDNRequired"; removeflag "$MDNRequired";
# fileinto :flags "${flagvar}" "INBOX.imap-list"; fileinto "INBOX.imap-list";
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.