New file. Provides standard sieve tests (all noops, so far)
Showing
1 changed file
with
149 additions
and
0 deletions
libsieve/tests.c
0 → 100644
1 | /* GNU mailutils - a suite of utilities for electronic mail | ||
2 | Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
17 | |||
18 | #ifdef HAVE_CONFIG_H | ||
19 | # include <config.h> | ||
20 | #endif | ||
21 | |||
22 | #include <stdio.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <unistd.h> | ||
25 | #include <string.h> | ||
26 | #include <sieve.h> | ||
27 | |||
28 | #define TAG_LOCALPART 0 | ||
29 | #define TAG_DOMAIN 1 | ||
30 | #define TAG_ALL 2 | ||
31 | #define TAG_COMPARATOR 3 | ||
32 | #define TAG_IS 4 | ||
33 | #define TAG_CONTAINS 5 | ||
34 | #define TAG_MATCHES 6 | ||
35 | #define TAG_REGEX 7 | ||
36 | #define TAG_UNDER 8 | ||
37 | #define TAG_OVER 9 | ||
38 | |||
39 | int | ||
40 | sieve_test_address (sieve_machine_t *mach, list_t *args) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | int | ||
45 | sieve_test_header (sieve_machine_t *mach, list_t *args) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | int | ||
50 | sieve_test_envelope (sieve_machine_t *mach, list_t *args) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | int | ||
55 | sieve_test_size (sieve_machine_t *mach, list_t *args) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | int | ||
60 | sieve_test_true (sieve_machine_t *mach, list_t *args) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | int | ||
65 | sieve_test_false (sieve_machine_t *mach, list_t *args) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | int | ||
70 | sieve_test_exists (sieve_machine_t *mach, list_t *args) | ||
71 | { | ||
72 | } | ||
73 | |||
74 | #define ADDRESS_PART \ | ||
75 | { "localpart", TAG_LOCALPART, SVT_VOID },\ | ||
76 | { "domain", TAG_DOMAIN, SVT_VOID },\ | ||
77 | { "all", TAG_ALL, SVT_VOID } | ||
78 | |||
79 | #define MATCH_PART \ | ||
80 | { "is", TAG_IS, SVT_VOID },\ | ||
81 | { "contains", TAG_CONTAINS, SVT_VOID },\ | ||
82 | { "matches", TAG_MATCHES, SVT_VOID },\ | ||
83 | { "regex", TAG_REGEX, SVT_VOID } | ||
84 | |||
85 | #define COMP_PART \ | ||
86 | { "comparator", TAG_COMPARATOR, SVT_STRING } | ||
87 | |||
88 | #define SIZE_PART \ | ||
89 | { "under", TAG_UNDER, SVT_VOID },\ | ||
90 | { "over", TAG_OVER, SVT_VOID } | ||
91 | |||
92 | |||
93 | sieve_tag_def_t address_tags[] = { | ||
94 | ADDRESS_PART, | ||
95 | COMP_PART, | ||
96 | MATCH_PART, | ||
97 | { NULL } | ||
98 | }; | ||
99 | |||
100 | sieve_data_type address_req_args[] = { | ||
101 | SVT_STRING_LIST, | ||
102 | SVT_STRING_LIST, | ||
103 | SVT_VOID | ||
104 | }; | ||
105 | |||
106 | sieve_tag_def_t size_tags[] = { | ||
107 | SIZE_PART, | ||
108 | { NULL } | ||
109 | }; | ||
110 | |||
111 | sieve_data_type size_req_args[] = { | ||
112 | SVT_NUMBER, | ||
113 | SVT_VOID | ||
114 | }; | ||
115 | |||
116 | sieve_tag_def_t envelope_tags[] = { | ||
117 | COMP_PART, | ||
118 | ADDRESS_PART, | ||
119 | MATCH_PART, | ||
120 | { NULL } | ||
121 | }; | ||
122 | |||
123 | sieve_data_type exists_req_args[] = { | ||
124 | SVT_STRING_LIST, | ||
125 | SVT_VOID | ||
126 | }; | ||
127 | |||
128 | sieve_tag_def_t header_tags[] = { | ||
129 | COMP_PART, | ||
130 | MATCH_PART, | ||
131 | { NULL }, | ||
132 | }; | ||
133 | |||
134 | void | ||
135 | sieve_register_standard_tests () | ||
136 | { | ||
137 | sieve_register_test ("false", sieve_test_false, NULL, NULL, 1); | ||
138 | sieve_register_test ("true", sieve_test_false, NULL, NULL, 1); | ||
139 | sieve_register_test ("address", sieve_test_address, | ||
140 | address_req_args, address_tags, 1); | ||
141 | sieve_register_test ("size", sieve_test_size, | ||
142 | size_req_args, size_tags, 1); | ||
143 | sieve_register_test ("envelope", sieve_test_envelope, | ||
144 | address_req_args, envelope_tags, 1); | ||
145 | sieve_register_test ("exists", sieve_test_exists, | ||
146 | exists_req_args, NULL, 1); | ||
147 | sieve_register_test ("header", sieve_test_header, | ||
148 | address_req_args, header_tags, 1); | ||
149 | } |
-
Please register or sign in to post a comment