/src/pigeonhole/src/lib-sieve/plugins/index/ext-index.c
Line | Count | Source |
1 | | /* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file |
2 | | */ |
3 | | |
4 | | /* Extension index |
5 | | * ------------------ |
6 | | * |
7 | | * Authors: Stephan Bosch |
8 | | * Specification: RFC 5260 |
9 | | * Implementation: full |
10 | | * Status: testing |
11 | | * |
12 | | */ |
13 | | |
14 | | #include "lib.h" |
15 | | #include "array.h" |
16 | | |
17 | | #include "sieve-common.h" |
18 | | #include "sieve-message.h" |
19 | | #include "sieve-extensions.h" |
20 | | #include "sieve-commands.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-index-common.h" |
29 | | |
30 | | /* |
31 | | * Extension |
32 | | */ |
33 | | |
34 | | static bool ext_index_validator_load |
35 | | (const struct sieve_extension *ext, struct sieve_validator *validator); |
36 | | |
37 | | const struct sieve_extension_def index_extension = { |
38 | | .name = "index", |
39 | | .validator_load = ext_index_validator_load, |
40 | | SIEVE_EXT_DEFINE_OPERAND(index_operand) |
41 | | }; |
42 | | |
43 | | static bool ext_index_validator_load |
44 | | (const struct sieve_extension *ext, struct sieve_validator *valdtr) |
45 | 0 | { |
46 | | /* Register :index and :last tags with header, address and date test commands |
47 | | * and we don't care whether these command are registered or even whether |
48 | | * these will be registered at all. The validator handles either situation |
49 | | * gracefully. |
50 | | */ |
51 | 0 | sieve_validator_register_external_tag |
52 | 0 | (valdtr, "header", ext, &index_tag, SIEVE_OPT_MESSAGE_OVERRIDE); |
53 | 0 | sieve_validator_register_external_tag |
54 | 0 | (valdtr, "header", ext, &last_tag, 0); |
55 | |
|
56 | 0 | sieve_validator_register_external_tag |
57 | 0 | (valdtr, "address", ext, &index_tag, SIEVE_OPT_MESSAGE_OVERRIDE); |
58 | 0 | sieve_validator_register_external_tag |
59 | 0 | (valdtr, "address", ext, &last_tag, 0); |
60 | |
|
61 | 0 | sieve_validator_register_external_tag |
62 | 0 | (valdtr, "date", ext, &index_tag, SIEVE_OPT_MESSAGE_OVERRIDE); |
63 | 0 | sieve_validator_register_external_tag |
64 | 0 | (valdtr, "date", ext, &last_tag, 0); |
65 | |
|
66 | 0 | return TRUE; |
67 | 0 | } |
68 | | |
69 | | |