/src/pigeonhole/src/lib-sieve/plugins/ihave/ext-ihave.c
Line | Count | Source |
1 | | /* Copyright (c) Pigeonhole authors, see top-level COPYING file */ |
2 | | |
3 | | /* Extension ihave |
4 | | * --------------- |
5 | | * |
6 | | * Authors: Stephan Bosch |
7 | | * Specification: RFC 5463 |
8 | | * Implementation: full |
9 | | * Status: testing |
10 | | * |
11 | | */ |
12 | | |
13 | | #include "lib.h" |
14 | | |
15 | | #include "sieve-common.h" |
16 | | #include "sieve-extensions.h" |
17 | | #include "sieve-code.h" |
18 | | #include "sieve-binary.h" |
19 | | #include "sieve-validator.h" |
20 | | #include "sieve-generator.h" |
21 | | |
22 | | #include "ext-ihave-common.h" |
23 | | #include "ext-ihave-binary.h" |
24 | | |
25 | | /* |
26 | | * Operations |
27 | | */ |
28 | | |
29 | | const struct sieve_operation_def *ext_ihave_operations[] = { |
30 | | &tst_ihave_operation, |
31 | | &cmd_error_operation, |
32 | | }; |
33 | | |
34 | | /* |
35 | | * Extension |
36 | | */ |
37 | | |
38 | | static bool |
39 | | ext_ihave_validator_load(const struct sieve_extension *ext, |
40 | | struct sieve_validator *validator); |
41 | | static bool |
42 | | ext_ihave_generator_load(const struct sieve_extension *ext, |
43 | | const struct sieve_codegen_env *cgenv); |
44 | | |
45 | | const struct sieve_extension_def ihave_extension = { |
46 | | "ihave", |
47 | | .version = 1, |
48 | | .validator_load = ext_ihave_validator_load, |
49 | | .generator_load = ext_ihave_generator_load, |
50 | | .binary_load = ext_ihave_binary_load, |
51 | | .binary_dump = ext_ihave_binary_dump, |
52 | | SIEVE_EXT_DEFINE_OPERATIONS(ext_ihave_operations), |
53 | | }; |
54 | | |
55 | | static bool |
56 | | ext_ihave_validator_load(const struct sieve_extension *ext, |
57 | | struct sieve_validator *validator) |
58 | 0 | { |
59 | 0 | sieve_validator_register_command(validator, ext, &ihave_test); |
60 | 0 | sieve_validator_register_command(validator, ext, &error_command); |
61 | |
|
62 | 0 | return TRUE; |
63 | 0 | } |
64 | | |
65 | | static bool |
66 | | ext_ihave_generator_load(const struct sieve_extension *ext, |
67 | | const struct sieve_codegen_env *cgenv) |
68 | 0 | { |
69 | 0 | (void)ext_ihave_binary_init(ext, cgenv->sbin, cgenv->ast); |
70 | |
|
71 | 0 | return TRUE; |
72 | 0 | } |