File: ext-variables-modifiers.h

package info (click to toggle)
dovecot 1%3A1.2.15-7%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 30,340 kB
  • ctags: 20,012
  • sloc: ansic: 191,443; sh: 21,091; makefile: 3,330; cpp: 526; perl: 108; xml: 44
file content (62 lines) | stat: -rw-r--r-- 1,832 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright (c) 2002-2010 Dovecot Sieve authors, see the included COPYING file
 */

#ifndef __EXT_VARIABLES_MODIFIERS_H
#define __EXT_VARIABLES_MODIFIERS_H

#include "ext-variables-common.h"
#include "sieve-ext-variables.h"

#define ext_variables_namespace_name(nspc) \
	(nspc)->object->def->name
#define ext_variables_namespaces_equal(nspc1, nspc2) \
	( (nspc1)->def == (nspc2)->def ))

/*
 * Modifier registry
 */

bool ext_variables_modifier_exists
	(const struct sieve_extension *var_ext, struct sieve_validator *valdtr,
		const char *identifier);
const struct sieve_variables_modifier *ext_variables_modifier_create_instance
	(const struct sieve_extension *var_ext, struct sieve_validator *valdtr,
		struct sieve_command *cmd, const char *identifier);

void ext_variables_register_core_modifiers
	(const struct sieve_extension *var_ext,
		struct ext_variables_validator_context *ctx);

/*
 * Modifier operand
 */

extern const struct sieve_operand_def modifier_operand;

static inline void ext_variables_opr_modifier_emit
(struct sieve_binary *sbin, const struct sieve_extension *ext,
	const struct sieve_variables_modifier_def *modf_def)
{
	sieve_opr_object_emit(sbin, ext, &modf_def->obj_def);
}

static inline bool ext_variables_opr_modifier_read
(const struct sieve_runtime_env *renv, sieve_size_t *address,
	struct sieve_variables_modifier *modf)
{
	if ( !sieve_opr_object_read
		(renv, &sieve_variables_modifier_operand_class, address, &modf->object) )
		return FALSE;

	modf->def = (const struct sieve_variables_modifier_def *) modf->object.def;
	return TRUE;
}

static inline bool ext_variables_opr_modifier_dump
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
{
	return sieve_opr_object_dump
		(denv, &sieve_variables_modifier_operand_class, address, NULL);
}

#endif /* __EXT_VARIABLES_MODIFIERS_H */