7 |
#include "filter.h" |
#include "filter.h" |
8 |
|
|
9 |
|
|
10 |
extern conn_t connpri, connaux; |
extern options_t opts; |
11 |
extern char charset[CHARSET_LEN]; |
extern connection_t connpri, connaux; |
12 |
|
|
13 |
|
|
14 |
int match_filter(filter_t * filter, char **mesgs); |
int match_filter(filter_t * filter, char **mesgs); |
52 |
|
|
53 |
|
|
54 |
/* |
/* |
55 |
* Generate the search request by the masks of the filter and try to |
* Generate the search request by the masks of the filter and try to match the |
56 |
* match the generated filter. |
* generated filter. |
57 |
*/ |
*/ |
58 |
int |
int |
59 |
match_filter(filter_t * filter, char **mesgs) |
match_filter(filter_t * filter, char **mesgs) |
67 |
search = generate_filter_and(filter->masks, filter->masknum, |
search = generate_filter_and(filter->masks, filter->masknum, |
68 |
filter->masklen); |
filter->masklen); |
69 |
|
|
70 |
search_response(&connpri, imap_search(&connpri, charset, search), |
response_search(&connpri, imap_search(&connpri, opts.charset, search), |
71 |
mesgs); |
mesgs); |
72 |
|
|
73 |
xfree(search); |
xfree(search); |
80 |
|
|
81 |
|
|
82 |
/* |
/* |
83 |
* Generate the filter search command from the masks, assuming that |
* Generate the filter search command from the masks, assuming that masks are |
84 |
* masks are AND-ed. |
* AND-ed. |
85 |
*/ |
*/ |
86 |
char * |
char * |
87 |
generate_filter_and(mask_t * mask, unsigned int masknum, |
generate_filter_and(mask_t * mask, unsigned int masknum, |
157 |
|
|
158 |
|
|
159 |
/* |
/* |
160 |
* Generate the filter search command from the masks, assuming that |
* Generate the filter search command from the masks, assuming that masks are |
161 |
* masks are OR-ed. |
* OR-ed. |
162 |
*/ |
*/ |
163 |
char * |
char * |
164 |
generate_filter_or(mask_t * mask, unsigned int masknum, |
generate_filter_or(mask_t * mask, unsigned int masknum, |
234 |
static char nb[MASK_BODY_LEN]; |
static char nb[MASK_BODY_LEN]; |
235 |
|
|
236 |
|
|
237 |
if (strstr(body, "OLDER") || |
if (strstr(body, "OLDER") || strstr(body, "NEWER")) { |
|
strstr(body, "NEWER")) { |
|
238 |
xstrncpy(nb, body, MASK_BODY_LEN - 1); |
xstrncpy(nb, body, MASK_BODY_LEN - 1); |
239 |
convert_date(nb); |
convert_date(nb); |
240 |
|
|
286 |
void |
void |
287 |
empty_fifo(mask_t ** mfifo) |
empty_fifo(mask_t ** mfifo) |
288 |
{ |
{ |
289 |
|
|
290 |
mfifo[0] = NULL; |
mfifo[0] = NULL; |
291 |
|
|
292 |
queue_fifo(NULL, NULL); |
queue_fifo(NULL, NULL); |