/src/pigeonhole/src/lib-sieve/plugins/vnd.dovecot/debug/ext-debug.c
Line | Count | Source |
1 | | /* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file |
2 | | */ |
3 | | |
4 | | /* Extension debug |
5 | | * --------------- |
6 | | * |
7 | | * Authors: Stephan Bosch |
8 | | * Specification: vendor-defined; spec-bosch-sieve-debug |
9 | | * Implementation: full |
10 | | * Status: experimental |
11 | | * |
12 | | */ |
13 | | |
14 | | #include "lib.h" |
15 | | #include "array.h" |
16 | | |
17 | | #include "sieve-extensions.h" |
18 | | #include "sieve-commands.h" |
19 | | #include "sieve-comparators.h" |
20 | | #include "sieve-match-types.h" |
21 | | #include "sieve-address-parts.h" |
22 | | |
23 | | #include "sieve-validator.h" |
24 | | #include "sieve-generator.h" |
25 | | #include "sieve-binary.h" |
26 | | #include "sieve-interpreter.h" |
27 | | #include "sieve-dump.h" |
28 | | |
29 | | #include "ext-debug-common.h" |
30 | | |
31 | | /* |
32 | | * Extension |
33 | | */ |
34 | | |
35 | | static bool ext_debug_validator_load |
36 | | (const struct sieve_extension *ext, struct sieve_validator *validator); |
37 | | static bool ext_debug_interpreter_load |
38 | | (const struct sieve_extension *ext ATTR_UNUSED, |
39 | | const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED); |
40 | | |
41 | | |
42 | | const struct sieve_extension_def vnd_debug_extension = { |
43 | | .name = "vnd.dovecot.debug", |
44 | | .validator_load = ext_debug_validator_load, |
45 | | .interpreter_load = ext_debug_interpreter_load, |
46 | | SIEVE_EXT_DEFINE_OPERATION(debug_log_operation), |
47 | | }; |
48 | | |
49 | | static bool ext_debug_validator_load |
50 | | (const struct sieve_extension *ext, struct sieve_validator *validator) |
51 | 0 | { |
52 | | /* Register new test */ |
53 | 0 | sieve_validator_register_command(validator, ext, &debug_log_command); |
54 | |
|
55 | 0 | return TRUE; |
56 | 0 | } |
57 | | |
58 | | static bool ext_debug_interpreter_load |
59 | | (const struct sieve_extension *ext ATTR_UNUSED, |
60 | | const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED) |
61 | 0 | { |
62 | 0 | if ( renv->ehandler != NULL ) { |
63 | 0 | sieve_error_handler_accept_infolog(renv->ehandler, TRUE); |
64 | 0 | } |
65 | |
|
66 | 0 | return TRUE; |
67 | 0 | } |
68 | | |
69 | | |
70 | | |