Commit 0093f3b1 0093f3b17f4f6715bd95e98e9a10e366755298e7 by Sergey Poznyakoff

(sieve_comparator_t,sieve_retrieve_t): New datatypes.

(sieve_vlist_do,sieve_vlist_compare,sieve_comparator_lookup)
(sieve_register_comparator,sieve_get_comparator): New functions.
(sieve_action_discard): Log output made compatible with that of
CMU ported sieve.
1 parent 860f57e2
...@@ -21,17 +21,21 @@ ...@@ -21,17 +21,21 @@
21 21
22 typedef struct sieve_machine *sieve_machine_t; 22 typedef struct sieve_machine *sieve_machine_t;
23 23
24 typedef int (*sieve_handler_t) __P((sieve_machine_t mach, 24 typedef int (*sieve_handler_t) __PMT((sieve_machine_t mach,
25 list_t args, list_t tags)); 25 list_t args, list_t tags));
26 typedef int (*sieve_printf_t) __P((void *data, const char *fmt, va_list ap)); 26 typedef int (*sieve_printf_t) __PMT((void *data, const char *fmt, va_list ap));
27 typedef int (*sieve_parse_error_t) __P((void *data, 27 typedef int (*sieve_parse_error_t) __PMT((void *data,
28 const char *filename, int lineno, 28 const char *filename, int lineno,
29 const char *fmt, va_list ap)); 29 const char *fmt, va_list ap));
30 typedef void (*sieve_action_log_t) __P((void *data, 30 typedef void (*sieve_action_log_t) __PMT((void *data,
31 const char *script, 31 const char *script,
32 size_t msgno, message_t msg, 32 size_t msgno, message_t msg,
33 const char *action, 33 const char *action,
34 const char *fmt, va_list ap)); 34 const char *fmt, va_list ap));
35
36 typedef int (*sieve_comparator_t) __PMT((const char *, const char *));
37 typedef int (*sieve_retrieve_t) __PMT((void *item, void *data, char **pval));
38
35 39
36 typedef enum { 40 typedef enum {
37 SVT_VOID, 41 SVT_VOID,
...@@ -76,6 +80,12 @@ typedef struct { ...@@ -76,6 +80,12 @@ typedef struct {
76 sieve_tag_def_t *tags; 80 sieve_tag_def_t *tags;
77 } sieve_register_t; 81 } sieve_register_t;
78 82
83 #define MU_SIEVE_MATCH_IS 1
84 #define MU_SIEVE_MATCH_CONTAINS 2
85 #define MU_SIEVE_MATCH_MATCHES 3
86 #define MU_SIEVE_MATCH_REGEX 4
87 #define MU_SIEVE_MATCH_LAST 5
88
79 /* Debugging levels */ 89 /* Debugging levels */
80 #define MU_SIEVE_DEBUG_TRACE 0x0001 90 #define MU_SIEVE_DEBUG_TRACE 0x0001
81 #define MU_SIEVE_DEBUG_INSTR 0x0002 91 #define MU_SIEVE_DEBUG_INSTR 0x0002
...@@ -139,3 +149,20 @@ void sieve_machine_set_ticket __P((sieve_machine_t mach, ...@@ -139,3 +149,20 @@ void sieve_machine_set_ticket __P((sieve_machine_t mach,
139 sieve_value_t *sieve_value_get __P((list_t vlist, size_t index)); 149 sieve_value_t *sieve_value_get __P((list_t vlist, size_t index));
140 150
141 int sieve_is_dry_run __P((sieve_machine_t mach)); 151 int sieve_is_dry_run __P((sieve_machine_t mach));
152
153 int sieve_vlist_do __P((sieve_value_t *val, list_action_t *ac, void *data));
154 int sieve_vlist_compare __P((sieve_value_t *a, sieve_value_t *b,
155 sieve_comparator_t comp, sieve_retrieve_t ac,
156 void *data));
157
158
159 int sieve_register_comparator __P((const char *name,
160 int required,
161 sieve_comparator_t is,
162 sieve_comparator_t contains,
163 sieve_comparator_t matches,
164 sieve_comparator_t regex));
165 sieve_comparator_t sieve_comparator_lookup __P((const char *name,
166 int matchtype));
167
168 sieve_comparator_t sieve_get_comparator __P((list_t tags));
......