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

Cleaned up address part and comparator implementation.

parent ad66ace5
No related branches found
No related tags found
No related merge requests found
#include <stdio.h>
/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
*/
#include "lib.h"
#include "compat.h"
......@@ -113,6 +114,31 @@ void sieve_address_parts_link_tags
/*
* Address-part tagged argument
*/
/* Forward declarations */
static bool tag_address_part_is_instance_of
(struct sieve_validator *validator, struct sieve_command_context *cmd,
struct sieve_ast_argument *arg);
static bool tag_address_part_validate
(struct sieve_validator *validator, struct sieve_ast_argument **arg,
struct sieve_command_context *cmd);
static bool tag_address_part_generate
(const struct sieve_codegen_env *cgenv, struct sieve_ast_argument *arg,
struct sieve_command_context *cmd);
/* Argument object */
const struct sieve_argument address_part_tag = {
"ADDRESS-PART",
tag_address_part_is_instance_of,
NULL,
tag_address_part_validate,
NULL,
tag_address_part_generate
};
/* Argument implementation */
static bool tag_address_part_is_instance_of
(struct sieve_validator *validator, struct sieve_command_context *cmd,
......@@ -295,15 +321,6 @@ bool sieve_addrmatch_default_get_optionals
/*
* Core address-part modifiers
*/
const struct sieve_argument address_part_tag = {
"ADDRESS-PART",
tag_address_part_is_instance_of,
NULL,
tag_address_part_validate,
NULL,
tag_address_part_generate
};
static const char *addrp_all_extract_from
(const struct sieve_address *address)
......
/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
*/
#ifndef __SIEVE_ADDRESS_PARTS_H
#define __SIEVE_ADDRESS_PARTS_H
......@@ -87,7 +90,9 @@ static inline bool sieve_opr_address_part_dump
(denv, &sieve_address_part_operand_class, address, NULL);
}
/* Match utility */
/*
* Match utility
*/
int sieve_address_match
(const struct sieve_address_part *addrp, struct sieve_match_context *mctx,
......@@ -102,6 +107,7 @@ enum sieve_addrmatch_opt_operand {
bool sieve_addrmatch_default_dump_optionals
(const struct sieve_dumptime_env *denv, sieve_size_t *address);
bool sieve_addrmatch_default_get_optionals
(const struct sieve_runtime_env *renv, sieve_size_t *address,
const struct sieve_address_part **addp,
......
......@@ -109,14 +109,14 @@ bool cmp_validator_load(struct sieve_validator *validator)
* Comparator tagged argument
*/
/* Context associated with ast argument */
/* Context data */
struct sieve_comparator_context {
struct sieve_command_context *command_ctx;
const struct sieve_comparator *comparator;
};
/* Comparator argument */
/* Forward declarations */
static bool tag_comparator_validate
(struct sieve_validator *validator, struct sieve_ast_argument **arg,
......@@ -125,6 +125,8 @@ static bool tag_comparator_generate
(const struct sieve_codegen_env *cgenv, struct sieve_ast_argument *arg,
struct sieve_command_context *cmd);
/* Argument object */
const struct sieve_argument comparator_tag = {
"comparator",
NULL, NULL,
......@@ -133,6 +135,8 @@ const struct sieve_argument comparator_tag = {
tag_comparator_generate
};
/* Argument implementation */
static bool tag_comparator_validate
(struct sieve_validator *validator, struct sieve_ast_argument **arg,
struct sieve_command_context *cmd)
......
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.