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

lib-sieve: plugins: copy: Reformat ext-copy.c.

parent 99f1c8a1
No related branches found
No related tags found
No related merge requests found
......@@ -35,27 +35,29 @@ static const struct sieve_operand_def copy_side_effect_operand;
* Extension
*/
static bool ext_copy_validator_load
(const struct sieve_extension *ext, struct sieve_validator *valdtr);
static bool
ext_copy_validator_load(const struct sieve_extension *ext,
struct sieve_validator *valdtr);
const struct sieve_extension_def copy_extension = {
.name = "copy",
.validator_load = ext_copy_validator_load,
SIEVE_EXT_DEFINE_OPERAND(copy_side_effect_operand)
SIEVE_EXT_DEFINE_OPERAND(copy_side_effect_operand),
};
static bool ext_copy_validator_load
(const struct sieve_extension *ext, struct sieve_validator *valdtr)
static bool
ext_copy_validator_load(const struct sieve_extension *ext,
struct sieve_validator *valdtr)
{
/* Register copy tag with redirect and fileinto commands and we don't care
* whether these commands are registered or even whether they will be
* registered at all. The validator handles either situation gracefully
/* Register copy tag with redirect and fileinto commands and we don't
care whether these commands are registered or even whether they will
be registered at all. The validator handles either situation
gracefully.
*/
sieve_validator_register_external_tag
(valdtr, "redirect", ext, &copy_tag, SIEVE_OPT_SIDE_EFFECT);
sieve_validator_register_external_tag
(valdtr, "fileinto", ext, &copy_tag, SIEVE_OPT_SIDE_EFFECT);
sieve_validator_register_external_tag(valdtr, "redirect", ext,
&copy_tag, SIEVE_OPT_SIDE_EFFECT);
sieve_validator_register_external_tag(valdtr, "fileinto", ext,
&copy_tag, SIEVE_OPT_SIDE_EFFECT);
return TRUE;
}
......@@ -63,8 +65,9 @@ static bool ext_copy_validator_load
* Side effect
*/
static void seff_copy_print
(const struct sieve_side_effect *seffect, const struct sieve_action *action,
static void
seff_copy_print(const struct sieve_side_effect *seffect,
const struct sieve_action *action,
const struct sieve_result_print_env *rpenv, bool *keep);
static void
seff_copy_post_commit(const struct sieve_side_effect *seffect,
......@@ -75,24 +78,24 @@ const struct sieve_side_effect_def copy_side_effect = {
SIEVE_OBJECT("copy", &copy_side_effect_operand, 0),
.to_action = &act_store,
.print = seff_copy_print,
.post_commit = seff_copy_post_commit
.post_commit = seff_copy_post_commit,
};
/*
* Tagged argument
*/
static bool tag_copy_validate
(struct sieve_validator *valdtr, struct sieve_ast_argument **arg,
struct sieve_command *cmd);
static bool tag_copy_generate
(const struct sieve_codegen_env *cgenv, struct sieve_ast_argument *arg,
struct sieve_command *cmd);
static bool
tag_copy_validate(struct sieve_validator *valdtr,
struct sieve_ast_argument **arg, struct sieve_command *cmd);
static bool
tag_copy_generate(const struct sieve_codegen_env *cgenv,
struct sieve_ast_argument *arg, struct sieve_command *cmd);
static const struct sieve_argument_def copy_tag = {
.identifier = "copy",
.validate = tag_copy_validate,
.generate = tag_copy_generate
.generate = tag_copy_generate,
};
/*
......@@ -106,20 +109,21 @@ static const struct sieve_operand_def copy_side_effect_operand = {
.name = "copy operand",
.ext_def = &copy_extension,
.class = &sieve_side_effect_operand_class,
.interface = &ext_side_effects
.interface = &ext_side_effects,
};
/*
* Tag registration
*/
void sieve_ext_copy_register_tag
(struct sieve_validator *valdtr, const struct sieve_extension *copy_ext,
const char *command)
void sieve_ext_copy_register_tag(struct sieve_validator *valdtr,
const struct sieve_extension *copy_ext,
const char *command)
{
if ( sieve_validator_extension_loaded(valdtr, copy_ext) ) {
sieve_validator_register_external_tag
(valdtr, command, copy_ext, &copy_tag, SIEVE_OPT_SIDE_EFFECT);
if (sieve_validator_extension_loaded(valdtr, copy_ext)) {
sieve_validator_register_external_tag(
valdtr, command, copy_ext, &copy_tag,
SIEVE_OPT_SIDE_EFFECT);
}
}
......@@ -127,10 +131,10 @@ void sieve_ext_copy_register_tag
* Tag validation
*/
static bool tag_copy_validate
(struct sieve_validator *valdtr ATTR_UNUSED,
struct sieve_ast_argument **arg ATTR_UNUSED,
struct sieve_command *cmd ATTR_UNUSED)
static bool
tag_copy_validate(struct sieve_validator *valdtr ATTR_UNUSED,
struct sieve_ast_argument **arg ATTR_UNUSED,
struct sieve_command *cmd ATTR_UNUSED)
{
*arg = sieve_ast_argument_next(*arg);
......@@ -141,17 +145,16 @@ static bool tag_copy_validate
* Code generation
*/
static bool tag_copy_generate
(const struct sieve_codegen_env *cgenv, struct sieve_ast_argument *arg,
struct sieve_command *cmd ATTR_UNUSED)
static bool
tag_copy_generate(const struct sieve_codegen_env *cgenv,
struct sieve_ast_argument *arg,
struct sieve_command *cmd ATTR_UNUSED)
{
if ( sieve_ast_argument_type(arg) != SAAT_TAG ) {
if (sieve_ast_argument_type(arg) != SAAT_TAG)
return FALSE;
}
sieve_opr_side_effect_emit
(cgenv->sblock, sieve_argument_ext(arg), &copy_side_effect);
sieve_opr_side_effect_emit(cgenv->sblock, sieve_argument_ext(arg),
&copy_side_effect);
return TRUE;
}
......@@ -159,13 +162,12 @@ static bool tag_copy_generate
* Side effect implementation
*/
static void seff_copy_print
(const struct sieve_side_effect *seffect ATTR_UNUSED,
const struct sieve_action *action ATTR_UNUSED,
const struct sieve_result_print_env *rpenv, bool *keep)
static void
seff_copy_print(const struct sieve_side_effect *seffect ATTR_UNUSED,
const struct sieve_action *action ATTR_UNUSED,
const struct sieve_result_print_env *rpenv, bool *keep)
{
sieve_result_seffect_printf(rpenv, "preserve implicit keep");
*keep = TRUE;
}
......@@ -176,5 +178,3 @@ seff_copy_post_commit(const struct sieve_side_effect *seffect ATTR_UNUSED,
{
*keep = TRUE;
}
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.