(sieve_require): Implemented loadable tests.
Showing
1 changed file
with
22 additions
and
22 deletions
... | @@ -42,36 +42,36 @@ sieve_require (list_t slist) | ... | @@ -42,36 +42,36 @@ sieve_require (list_t slist) |
42 | 42 | ||
43 | for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr)) | 43 | for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr)) |
44 | { | 44 | { |
45 | char *s; | 45 | char *name; |
46 | int (*reqfn) __PMT ((sieve_machine_t mach, const char *name)) = NULL; | ||
47 | char *text = NULL; | ||
46 | 48 | ||
47 | iterator_current (itr, (void **)&s); | 49 | iterator_current (itr, (void **)&name); |
48 | 50 | ||
49 | if (strncmp (s, "comparator-", 11) == 0) | 51 | if (strncmp (name, "comparator-", 11) == 0) |
50 | { | 52 | { |
51 | if (sieve_require_comparator (sieve_machine, s + 11)) | 53 | name += 11; |
52 | { | 54 | reqfn = sieve_require_comparator; |
53 | sieve_compile_error (sieve_filename, sieve_line_num, | 55 | text = "comparator"; |
54 | "source for the required comparator %s is not available", | ||
55 | s + 11); | ||
56 | } | ||
57 | } | 56 | } |
58 | else if (strncmp (s, "test-", 5) == 0) /* GNU extension */ | 57 | else if (strncmp (name, "test-", 5) == 0) /* GNU extension */ |
59 | { | 58 | { |
60 | /* FIXME: test- requires are a GNU extension allowing to | 59 | name += 5; |
61 | declare user-defined tests */ | 60 | reqfn = sieve_require_test; |
61 | text = "test"; | ||
62 | } | 62 | } |
63 | else | 63 | else |
64 | { | 64 | { |
65 | sieve_register_t *reg; | 65 | reqfn = sieve_require_action; |
66 | reg = sieve_action_lookup (sieve_machine, s); | 66 | text = "action"; |
67 | if (!reg) | 67 | } |
68 | { | 68 | |
69 | sieve_compile_error (sieve_filename, sieve_line_num, | 69 | if (reqfn (sieve_machine, name)) |
70 | "source for the required action %s is not available", | 70 | { |
71 | s); | 71 | sieve_compile_error (sieve_filename, sieve_line_num, |
72 | break; | 72 | "source for the required %s %s is not available", |
73 | } | 73 | text, |
74 | reg->required = 1; | 74 | name); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | iterator_destroy (&itr); | 77 | iterator_destroy (&itr); | ... | ... |
-
Please register or sign in to post a comment