Mercurial > dovecot > core-2.2
annotate src/lib-storage/mail-search.h @ 3863:55df57c028d4 HEAD
Added "bool" type and changed all ints that were used as booleans to bool.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 13 Jan 2006 22:25:57 +0200 |
parents | 79790750c349 |
children | 204d7edc7cdc |
rev | line source |
---|---|
0 | 1 #ifndef __MAIL_SEARCH_H |
2 #define __MAIL_SEARCH_H | |
3 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
4 enum mail_search_arg_type { |
0 | 5 SEARCH_OR, |
6 SEARCH_SUB, | |
7 | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
8 /* sequence sets */ |
0 | 9 SEARCH_ALL, |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
10 SEARCH_SEQSET, |
0 | 11 |
12 /* flags */ | |
13 SEARCH_ANSWERED, | |
14 SEARCH_DELETED, | |
15 SEARCH_DRAFT, | |
16 SEARCH_FLAGGED, | |
17 SEARCH_SEEN, | |
18 SEARCH_RECENT, | |
19 SEARCH_KEYWORD, | |
20 | |
21 /* dates */ | |
22 SEARCH_BEFORE, | |
23 SEARCH_ON, | |
24 SEARCH_SINCE, | |
25 SEARCH_SENTBEFORE, | |
26 SEARCH_SENTON, | |
27 SEARCH_SENTSINCE, | |
28 | |
29 /* sizes */ | |
30 SEARCH_SMALLER, | |
31 SEARCH_LARGER, | |
32 | |
33 /* headers */ | |
34 SEARCH_HEADER, | |
1672
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
35 SEARCH_HEADER_ADDRESS, |
0 | 36 |
37 /* body */ | |
38 SEARCH_BODY, | |
1672
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
39 SEARCH_TEXT |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
40 }; |
0 | 41 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
42 struct mail_search_seqset { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
43 uint32_t seq1, seq2; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
44 struct mail_search_seqset *next; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
45 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
46 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
47 struct mail_search_arg { |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
48 struct mail_search_arg *next; |
0 | 49 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
50 enum mail_search_arg_type type; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
51 struct { |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
52 struct mail_search_arg *subargs; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1844
diff
changeset
|
53 struct mail_search_seqset *seqset; |
0 | 54 const char *str; |
55 } value; | |
56 | |
568
f2aa58c2afd0
SEARCH CHARSET support. Currently we do it through iconv() and only ASCII
Timo Sirainen <tss@iki.fi>
parents:
444
diff
changeset
|
57 void *context; |
1672
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
58 const char *hdr_field_name; /* for SEARCH_HEADER* */ |
0 | 59 unsigned int not:1; |
1844
4c2678dd65f1
Some optimizations to messageset handling in search.
Timo Sirainen <tss@iki.fi>
parents:
1672
diff
changeset
|
60 unsigned int match_always:1; /* result = 1 always */ |
0 | 61 |
1069
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
62 int result; /* -1 = unknown, 0 = unmatched, 1 = matched */ |
0 | 63 }; |
64 | |
1069
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
65 #define ARG_SET_RESULT(arg, res) \ |
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
66 STMT_START { \ |
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
67 (arg)->result = !(arg)->not ? (res) : \ |
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
68 (res) == -1 ? -1 : !(res); \ |
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
69 } STMT_END |
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
70 |
953
411006be3c66
Naming change for function typedefs.
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
71 typedef void (*mail_search_foreach_callback_t)(struct mail_search_arg *arg, |
411006be3c66
Naming change for function typedefs.
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
72 void *context); |
0 | 73 |
1844
4c2678dd65f1
Some optimizations to messageset handling in search.
Timo Sirainen <tss@iki.fi>
parents:
1672
diff
changeset
|
74 /* Reset the results in search arguments. match_always is reset only if |
4c2678dd65f1
Some optimizations to messageset handling in search.
Timo Sirainen <tss@iki.fi>
parents:
1672
diff
changeset
|
75 full_reset is TRUE. */ |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
1915
diff
changeset
|
76 void mail_search_args_reset(struct mail_search_arg *args, bool full_reset); |
0 | 77 |
78 /* goes through arguments in list that don't have a result yet. | |
1069
8024a2cdc406
Several search fixes, mostly related to matching multiple conditions.
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
79 Returns 1 = search matched, 0 = search unmatched, -1 = don't know yet */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
568
diff
changeset
|
80 int mail_search_args_foreach(struct mail_search_arg *args, |
953
411006be3c66
Naming change for function typedefs.
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
81 mail_search_foreach_callback_t callback, |
411006be3c66
Naming change for function typedefs.
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
82 void *context); |
0 | 83 |
1672
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
84 /* Fills have_headers and have_body based on if such search argument exists |
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
85 that needs to be checked. Returns the headers that we're searching for, or |
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
86 NULL if we're searching for TEXT. */ |
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
87 const char *const * |
8920600a8cfc
Index cache file rewrite. It's not finished yet and mbox support is
Timo Sirainen <tss@iki.fi>
parents:
1069
diff
changeset
|
88 mail_search_args_analyze(struct mail_search_arg *args, |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
1915
diff
changeset
|
89 bool *have_headers, bool *have_body); |
0 | 90 |
91 #endif |