194 |
int f = 0; |
int f = 0; |
195 |
int len; |
int len; |
196 |
|
|
197 |
snprintf(command, BIG_COMMAND_MAX, "%X SEARCH ", tag++); |
snprintf(command, BIG_COMMAND_MAX, "%X SEARCH", tag++); |
198 |
|
|
199 |
/* Go through the DENY type filters... */ |
/* Go through the DENY type filters... */ |
200 |
|
|
201 |
while (f < (dfcnt - 1)) { |
if (dfcnt > 0) { |
|
len = strlen(command); |
|
|
snprintf(command + len, BIG_COMMAND_MAX - len, "OR %s%s \"%s\" ", |
|
|
(dfilters[f]->custom ? "HEADER " : ""), dfilters[f]->name, |
|
|
dfilters[f]->body); |
|
|
f++; |
|
|
} |
|
|
|
|
|
len = strlen(command); |
|
|
snprintf(command + len, BIG_COMMAND_MAX - len, "%s%s \"%s\"", |
|
|
(dfilters[f]->custom ? "HEADER " : ""), dfilters[f]->name, |
|
|
dfilters[f]->body); |
|
|
|
|
|
/* ... and then continue to the ALLOW entries. */ |
|
202 |
|
|
203 |
f = 0; |
while (f < (dfcnt - 1)) { |
204 |
|
len = strlen(command); |
205 |
|
snprintf(command + len, BIG_COMMAND_MAX - len, |
206 |
|
" OR %s%s \"%s\"", |
207 |
|
(dfilters[f]->custom ? "HEADER " : ""), |
208 |
|
dfilters[f]->name, dfilters[f]->body); |
209 |
|
f++; |
210 |
|
} |
211 |
|
|
212 |
|
len = strlen(command); |
213 |
|
snprintf(command + len, BIG_COMMAND_MAX - len, " %s%s \"%s\"", |
214 |
|
(dfilters[f]->custom ? "HEADER " : ""), |
215 |
|
dfilters[f]->name, dfilters[f]->body); |
216 |
|
} else { |
217 |
|
len = strlen(command); |
218 |
|
snprintf(command + len, BIG_COMMAND_MAX - len, " ALL"); |
219 |
|
} |
220 |
|
|
221 |
|
/* ... and then continue to the ALLOW entries. */ |
222 |
|
|
223 |
|
f = 0; |
224 |
|
|
225 |
|
while (f < afcnt) { |
226 |
|
len = strlen(command); |
227 |
|
snprintf(command + len, BIG_COMMAND_MAX - len, |
228 |
|
" NOT %s%s \"%s\"", |
229 |
|
(afilters[f]->custom ? "HEADER " : ""), |
230 |
|
afilters[f]->name, afilters[f]->body); |
231 |
|
f++; |
232 |
|
} |
233 |
|
|
|
while (f < afcnt) { |
|
234 |
len = strlen(command); |
len = strlen(command); |
235 |
snprintf(command + len, BIG_COMMAND_MAX - len, " NOT %s%s \"%s\"", |
snprintf(command + len, BIG_COMMAND_MAX - len, "\r\n"); |
|
(afilters[f]->custom ? "HEADER " : ""), afilters[f]->name, |
|
|
afilters[f]->body); |
|
|
f++; |
|
|
} |
|
|
|
|
|
len = strlen(command); |
|
|
snprintf(command + len, BIG_COMMAND_MAX - len, "\r\n"); |
|
236 |
} |
} |
237 |
|
|
238 |
|
|
261 |
|
|
262 |
if (!(options & OPTION_TEST_MODE)) |
if (!(options & OPTION_TEST_MODE)) |
263 |
imap_store(messg); |
imap_store(messg); |
264 |
|
|
265 |
} while (*unwanted); |
} while (*unwanted); |
266 |
} |
} |