/src/pigeonhole/src/lib-sieve/plugins/regex/ext-regex.c
Line | Count | Source |
1 | | /* Copyright (c) Pigeonhole authors, see top-level COPYING file */ |
2 | | |
3 | | /* Extension regex |
4 | | * --------------- |
5 | | * |
6 | | * Authors: Stephan Bosch |
7 | | * Specification: draft-murchison-sieve-regex-08 (not latest) |
8 | | * Implementation: full |
9 | | * Status: testing |
10 | | * |
11 | | */ |
12 | | |
13 | | /* FIXME: Regular expressions are compiled during compilation and |
14 | | again during interpretation. This is suboptimal and should be |
15 | | changed. This requires dumping the compiled regex to the binary. |
16 | | Most likely, this will only be possible when we implement regular |
17 | | expressions ourselves. |
18 | | */ |
19 | | |
20 | | /* NOTE: Extension does not support unicode equality operator `[=e=]` or |
21 | | collation sequence `[.e.]` due to dovecot lib-regex limitations. |
22 | | */ |
23 | | |
24 | | #include "lib.h" |
25 | | #include "mempool.h" |
26 | | #include "buffer.h" |
27 | | |
28 | | #include "sieve-common.h" |
29 | | |
30 | | #include "sieve-code.h" |
31 | | #include "sieve-extensions.h" |
32 | | #include "sieve-commands.h" |
33 | | |
34 | | #include "sieve-comparators.h" |
35 | | #include "sieve-match-types.h" |
36 | | |
37 | | #include "sieve-validator.h" |
38 | | #include "sieve-generator.h" |
39 | | #include "sieve-interpreter.h" |
40 | | |
41 | | #include "ext-regex-common.h" |
42 | | |
43 | | #include <sys/types.h> |
44 | | |
45 | | /* |
46 | | * Extension |
47 | | */ |
48 | | |
49 | | static bool |
50 | | ext_regex_validator_load(const struct sieve_extension *ext, |
51 | | struct sieve_validator *validator); |
52 | | |
53 | | const struct sieve_extension_def regex_extension = { |
54 | | .name = "regex", |
55 | | .validator_load = ext_regex_validator_load, |
56 | | SIEVE_EXT_DEFINE_OPERAND(regex_match_type_operand), |
57 | | }; |
58 | | |
59 | | static bool |
60 | | ext_regex_validator_load(const struct sieve_extension *ext, |
61 | | struct sieve_validator *valdtr) |
62 | 0 | { |
63 | 0 | sieve_match_type_register(valdtr, ext, ®ex_match_type); |
64 | |
|
65 | 0 | return TRUE; |
66 | 0 | } |