mail-search.c revision d549ec5d174279916518b5490cd21baeda38dedf
e0ba54c7f985fc403b41c6e36d6a7f44908b23f0Timo Sirainen/* Copyright (c) 2002-2013 Dovecot authors, see the included COPYING file */
86bdb644d147a73df85abce4325254d694217a5fTimo Sirainenmail_search_arg_dup(pool_t pool, const struct mail_search_arg *arg);
86bdb644d147a73df85abce4325254d694217a5fTimo Sirainenstatic bool mail_search_arg_equals(const struct mail_search_arg *arg1,
e0ba54c7f985fc403b41c6e36d6a7f44908b23f0Timo Sirainenmailbox_uidset_change(struct mail_search_arg *arg, struct mailbox *box,
e0ba54c7f985fc403b41c6e36d6a7f44908b23f0Timo Sirainen const ARRAY_TYPE(seq_range) *search_saved_uidset)
f6ae9ae80a1fcf6c8f45ab759f0074caaa66c9c8Timo Sirainen unsigned int i, count;
f6ae9ae80a1fcf6c8f45ab759f0074caaa66c9c8Timo Sirainen if (arg->value.str != NULL && strcmp(arg->value.str, "$") == 0) {
f6ae9ae80a1fcf6c8f45ab759f0074caaa66c9c8Timo Sirainen /* SEARCHRES: Replace with saved uidset */
f6ae9ae80a1fcf6c8f45ab759f0074caaa66c9c8Timo Sirainen array_append_array(&arg->value.seqset, search_saved_uidset);
ae9691f7ef36d5272d72c90fa51393dfea5dd126Timo Sirainen /* make a copy of the UIDs */
2eccb2637d0153bb7f9ad39a70f254cece74342cTimo Sirainen /* empty set, keep it */
7877db7b5daad125b6cb3e015574f33871c9a51bTimo Sirainen memcpy(uids, array_idx(&arg->value.seqset, 0), sizeof(*uids) * count);
7877db7b5daad125b6cb3e015574f33871c9a51bTimo Sirainen /* put them back to the range as sequences */
10972f2a15f5538860fcc1d4adda227d59d2d757Timo Sirainen for (i = 0; i < count; i++) {
4ca2ccd50ad25260865f561e4ebf36899d7fe966Timo Sirainen mailbox_get_seq_range(box, uids[i].seq1, uids[i].seq2,
bool change_uidsets,
case SEARCH_UIDSET:
} T_END;
case SEARCH_MODSEQ:
case SEARCH_KEYWORDS:
keywords);
case SEARCH_MAILBOX_GLOB: {
case SEARCH_INTHREAD:
case SEARCH_SUB:
case SEARCH_OR:
case SEARCH_MODSEQ:
case SEARCH_KEYWORDS:
case SEARCH_MAILBOX_GLOB:
case SEARCH_INTHREAD:
case SEARCH_SUB:
case SEARCH_OR:
case SEARCH_SEQSET:
case SEARCH_SUB:
case SEARCH_OR:
case SEARCH_INTHREAD:
uids);
T_BEGIN {
} T_END;
static struct mail_search_arg *
case SEARCH_INTHREAD:
case SEARCH_OR:
case SEARCH_SUB:
case SEARCH_ALL:
case SEARCH_SEQSET:
case SEARCH_UIDSET:
case SEARCH_FLAGS:
case SEARCH_BEFORE:
case SEARCH_ON:
case SEARCH_SINCE:
case SEARCH_SMALLER:
case SEARCH_LARGER:
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
case SEARCH_KEYWORDS:
case SEARCH_BODY:
case SEARCH_TEXT:
case SEARCH_GUID:
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
case SEARCH_MODSEQ:
return new_arg;
static struct mail_search_arg *
return new_arg;
struct mail_search_args *
return new_args;
if (!full_reset)
if (!full_reset)
void *context)
void *context)
int result;
return result;
case SEARCH_OR:
case SEARCH_SUB:
case SEARCH_BEFORE:
case SEARCH_ON:
case SEARCH_SINCE:
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
case SEARCH_BODY:
case SEARCH_TEXT:
bool have_text;
return NULL;
bool ret;
case SEARCH_OR:
return TRUE;
return FALSE;
case SEARCH_SUB:
case SEARCH_INTHREAD:
return FALSE;
return TRUE;
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GLOB: {
T_BEGIN {
} T_END;
return TRUE;
return FALSE;
return TRUE;
!parent_and) {
case SEARCH_SUB:
case SEARCH_OR:
case SEARCH_INTHREAD:
return FALSE;
if (!parent_and) {
return TRUE;
return FALSE;
case SEARCH_OR:
case SEARCH_SUB:
case SEARCH_ALL:
return TRUE;
case SEARCH_SEQSET:
return FALSE;
case SEARCH_UIDSET:
case SEARCH_FLAGS:
case SEARCH_KEYWORDS:
case SEARCH_BEFORE:
case SEARCH_ON:
case SEARCH_SINCE:
case SEARCH_SMALLER:
case SEARCH_LARGER:
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
return FALSE;
case SEARCH_BODY:
case SEARCH_TEXT:
case SEARCH_GUID:
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
case SEARCH_MODSEQ: {
case SEARCH_INTHREAD:
i_unreached();
return FALSE;
return FALSE;
case SEARCH_OR:
case SEARCH_SUB:
case SEARCH_INTHREAD:
const unsigned char **data,
case SEARCH_OR:
case SEARCH_SUB:
case SEARCH_INTHREAD: