/src/pigeonhole/src/lib-sieve/plugins/mailbox/ext-mailbox.c
Line | Count | Source |
1 | | /* Copyright (c) Pigeonhole authors, see top-level COPYING file */ |
2 | | |
3 | | /* Extension mailbox |
4 | | * ------------------ |
5 | | * |
6 | | * Authors: Stephan Bosch |
7 | | * Specification: RFC 5490 |
8 | | * Implementation: full |
9 | | * Status: testing |
10 | | * |
11 | | */ |
12 | | |
13 | | #include "sieve-common.h" |
14 | | |
15 | | #include "sieve-code.h" |
16 | | #include "sieve-extensions.h" |
17 | | #include "sieve-actions.h" |
18 | | #include "sieve-commands.h" |
19 | | #include "sieve-validator.h" |
20 | | #include "sieve-generator.h" |
21 | | #include "sieve-interpreter.h" |
22 | | #include "sieve-result.h" |
23 | | |
24 | | #include "ext-mailbox-common.h" |
25 | | |
26 | | /* |
27 | | * Tag registration |
28 | | */ |
29 | | |
30 | | void sieve_ext_mailbox_register_create_tag( |
31 | | struct sieve_validator *valdtr, |
32 | | const struct sieve_extension *mailbox_ext, const char *command) |
33 | 0 | { |
34 | 0 | if (sieve_validator_extension_loaded(valdtr, mailbox_ext)) { |
35 | 0 | sieve_validator_register_external_tag( |
36 | 0 | valdtr, command, mailbox_ext, &mailbox_create_tag, |
37 | 0 | SIEVE_OPT_SIDE_EFFECT); |
38 | 0 | } |
39 | 0 | } |
40 | | |
41 | | |
42 | | /* |
43 | | * Extension |
44 | | */ |
45 | | |
46 | | static bool |
47 | | ext_mailbox_validator_load(const struct sieve_extension *ext, |
48 | | struct sieve_validator *valdtr); |
49 | | |
50 | | const struct sieve_extension_def mailbox_extension = { |
51 | | .name = "mailbox", |
52 | | .validator_load = ext_mailbox_validator_load, |
53 | | SIEVE_EXT_DEFINE_OPERATION(mailboxexists_operation), |
54 | | SIEVE_EXT_DEFINE_OPERAND(mailbox_create_operand), |
55 | | }; |
56 | | |
57 | | static bool |
58 | | ext_mailbox_validator_load(const struct sieve_extension *ext, |
59 | | struct sieve_validator *valdtr) |
60 | 0 | { |
61 | | /* Register :create tag with fileinto command and we don't care whether |
62 | | this command is registered or even whether it will be registered at |
63 | | all. The validator handles either situation gracefully. |
64 | | */ |
65 | 0 | sieve_validator_register_external_tag( |
66 | 0 | valdtr, "fileinto", ext, &mailbox_create_tag, |
67 | 0 | SIEVE_OPT_SIDE_EFFECT); |
68 | | |
69 | | /* Register new test */ |
70 | 0 | sieve_validator_register_command(valdtr, ext, &mailboxexists_test); |
71 | |
|
72 | 0 | return TRUE; |
73 | 0 | } |