Commit 677d309d 677d309dd58a066f639edeb5b1140ea7a42a827f by Sergey Poznyakoff

(sieve_relcmp_t,sieve_relcmpn_t): New types.

(sieve_register_comparator): Changed prototype.
(sieve_require_relational,sieve_str_to_relcmp)
(sieve_get_relcmp): New functions.
1 parent c0d05cc4
...@@ -43,6 +43,8 @@ typedef void (*sieve_action_log_t) __PMT((void *data, ...@@ -43,6 +43,8 @@ typedef void (*sieve_action_log_t) __PMT((void *data,
43 const char *action, 43 const char *action,
44 const char *fmt, va_list ap)); 44 const char *fmt, va_list ap));
45 45
46 typedef int (*sieve_relcmp_t) __PMT((int, int));
47 typedef int (*sieve_relcmpn_t) __PMT((size_t, size_t));
46 typedef int (*sieve_comparator_t) __PMT((const char *, const char *)); 48 typedef int (*sieve_comparator_t) __PMT((const char *, const char *));
47 typedef int (*sieve_retrieve_t) __PMT((void *item, void *data, int idx, char **pval)); 49 typedef int (*sieve_retrieve_t) __PMT((void *item, void *data, int idx, char **pval));
48 typedef void (*sieve_destructor_t) __PMT((void *data)); 50 typedef void (*sieve_destructor_t) __PMT((void *data));
...@@ -100,7 +102,8 @@ typedef struct { ...@@ -100,7 +102,8 @@ typedef struct {
100 #define MU_SIEVE_MATCH_CONTAINS 2 102 #define MU_SIEVE_MATCH_CONTAINS 2
101 #define MU_SIEVE_MATCH_MATCHES 3 103 #define MU_SIEVE_MATCH_MATCHES 3
102 #define MU_SIEVE_MATCH_REGEX 4 104 #define MU_SIEVE_MATCH_REGEX 4
103 #define MU_SIEVE_MATCH_LAST 5 105 #define MU_SIEVE_MATCH_EQ 5
106 #define MU_SIEVE_MATCH_LAST 6
104 107
105 /* Debugging levels */ 108 /* Debugging levels */
106 #define MU_SIEVE_DEBUG_TRACE 0x0001 109 #define MU_SIEVE_DEBUG_TRACE 0x0001
...@@ -146,10 +149,12 @@ int sieve_register_comparator __P((sieve_machine_t mach, ...@@ -146,10 +149,12 @@ int sieve_register_comparator __P((sieve_machine_t mach,
146 sieve_comparator_t is, 149 sieve_comparator_t is,
147 sieve_comparator_t contains, 150 sieve_comparator_t contains,
148 sieve_comparator_t matches, 151 sieve_comparator_t matches,
149 sieve_comparator_t regex)); 152 sieve_comparator_t regex,
153 sieve_comparator_t eq));
150 int sieve_require_action __P((sieve_machine_t mach, const char *name)); 154 int sieve_require_action __P((sieve_machine_t mach, const char *name));
151 int sieve_require_test __P((sieve_machine_t mach, const char *name)); 155 int sieve_require_test __P((sieve_machine_t mach, const char *name));
152 int sieve_require_comparator __P((sieve_machine_t mach, const char *name)); 156 int sieve_require_comparator __P((sieve_machine_t mach, const char *name));
157 int sieve_require_relational __P((sieve_machine_t mach, const char *name));
153 158
154 sieve_comparator_t sieve_comparator_lookup __P((sieve_machine_t mach, 159 sieve_comparator_t sieve_comparator_lookup __P((sieve_machine_t mach,
155 const char *name, 160 const char *name,
...@@ -157,6 +162,9 @@ sieve_comparator_t sieve_comparator_lookup __P((sieve_machine_t mach, ...@@ -157,6 +162,9 @@ sieve_comparator_t sieve_comparator_lookup __P((sieve_machine_t mach,
157 162
158 sieve_comparator_t sieve_get_comparator __P((sieve_machine_t mach, 163 sieve_comparator_t sieve_get_comparator __P((sieve_machine_t mach,
159 list_t tags)); 164 list_t tags));
165 int sieve_str_to_relcmp __P((const char *str,
166 sieve_relcmp_t *test, sieve_relcmpn_t *stest));
167 sieve_relcmp_t sieve_get_relcmp __P((sieve_machine_t mach, list_t tags));
160 168
161 void sieve_require __P((list_t slist)); 169 void sieve_require __P((list_t slist));
162 int sieve_tag_lookup __P((list_t taglist, char *name, sieve_value_t **arg)); 170 int sieve_tag_lookup __P((list_t taglist, char *name, sieve_value_t **arg));
...@@ -166,8 +174,10 @@ int sieve_load_ext __P((sieve_machine_t mach, const char *name)); ...@@ -166,8 +174,10 @@ int sieve_load_ext __P((sieve_machine_t mach, const char *name));
166 sieve_value_t *sieve_value_get __P((list_t vlist, size_t index)); 174 sieve_value_t *sieve_value_get __P((list_t vlist, size_t index));
167 int sieve_vlist_do __P((sieve_value_t *val, list_action_t *ac, void *data)); 175 int sieve_vlist_do __P((sieve_value_t *val, list_action_t *ac, void *data));
168 int sieve_vlist_compare __P((sieve_value_t *a, sieve_value_t *b, 176 int sieve_vlist_compare __P((sieve_value_t *a, sieve_value_t *b,
169 sieve_comparator_t comp, sieve_retrieve_t ac, 177 sieve_comparator_t comp, sieve_relcmp_t test,
170 void *data)); 178 sieve_retrieve_t ac,
179 void *data,
180 size_t *count));
171 181
172 /* Functions to create and destroy sieve machine */ 182 /* Functions to create and destroy sieve machine */
173 int sieve_machine_init __P((sieve_machine_t *mach, void *data)); 183 int sieve_machine_init __P((sieve_machine_t *mach, void *data));
......