/src/pigeonhole/src/lib-sieve/plugins/variables/ext-variables.c
Line | Count | Source |
1 | | /* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file |
2 | | */ |
3 | | |
4 | | /* Extension variables |
5 | | * ------------------- |
6 | | * |
7 | | * Authors: Stephan Bosch |
8 | | * Specification: RFC 5229 |
9 | | * Implementation: full |
10 | | * Status: testing |
11 | | * |
12 | | */ |
13 | | |
14 | | #include "lib.h" |
15 | | #include "str.h" |
16 | | #include "unichar.h" |
17 | | |
18 | | #include "sieve-extensions.h" |
19 | | #include "sieve-commands.h" |
20 | | #include "sieve-binary.h" |
21 | | #include "sieve-interpreter.h" |
22 | | |
23 | | #include "sieve-validator.h" |
24 | | |
25 | | #include "ext-variables-common.h" |
26 | | #include "ext-variables-arguments.h" |
27 | | #include "ext-variables-operands.h" |
28 | | #include "ext-variables-namespaces.h" |
29 | | #include "ext-variables-modifiers.h" |
30 | | #include "ext-variables-dump.h" |
31 | | |
32 | | /* |
33 | | * Operations |
34 | | */ |
35 | | |
36 | | const struct sieve_operation_def *ext_variables_operations[] = { |
37 | | &cmd_set_operation, |
38 | | &tst_string_operation |
39 | | }; |
40 | | |
41 | | /* |
42 | | * Operands |
43 | | */ |
44 | | |
45 | | const struct sieve_operand_def *ext_variables_operands[] = { |
46 | | &variable_operand, |
47 | | &match_value_operand, |
48 | | &namespace_variable_operand, |
49 | | &modifier_operand |
50 | | }; |
51 | | |
52 | | /* |
53 | | * Extension |
54 | | */ |
55 | | |
56 | | static bool ext_variables_validator_load |
57 | | (const struct sieve_extension *ext, struct sieve_validator *validator); |
58 | | |
59 | | const struct sieve_extension_def variables_extension = { |
60 | | .name = "variables", |
61 | | .load = ext_variables_load, |
62 | | .unload = ext_variables_unload, |
63 | | .validator_load = ext_variables_validator_load, |
64 | | .generator_load = ext_variables_generator_load, |
65 | | .interpreter_load = ext_variables_interpreter_load, |
66 | | .code_dump = ext_variables_code_dump, |
67 | | SIEVE_EXT_DEFINE_OPERATIONS(ext_variables_operations), |
68 | | SIEVE_EXT_DEFINE_OPERANDS(ext_variables_operands) |
69 | | }; |
70 | | |
71 | | static bool ext_variables_validator_load |
72 | | (const struct sieve_extension *ext, struct sieve_validator *validator) |
73 | 0 | { |
74 | 0 | sieve_validator_argument_override |
75 | 0 | (validator, SAT_VAR_STRING, ext, &variable_string_argument); |
76 | |
|
77 | 0 | sieve_validator_register_command(validator, ext, &cmd_set); |
78 | 0 | sieve_validator_register_command(validator, ext, &tst_string); |
79 | |
|
80 | 0 | ext_variables_validator_initialize(ext, validator); |
81 | |
|
82 | 0 | return TRUE; |
83 | 0 | } |
84 | | |