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