mail-search.c revision d895dc66e265499115a6c0cff4d3e074dbeb5323
/* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "buffer.h"
#include "mail-index.h"
#include "mail-storage.h"
#include "mail-search-build.h"
#include "mail-search.h"
static struct mail_search_arg *
const struct mail_search_arg *arg2);
static void
{
unsigned int i, count;
/* SEARCHRES: Replace with saved uidset */
if (search_saved_uidset == NULL ||
return;
return;
}
/* make a copy of the UIDs */
if (count == 0) {
/* empty set, keep it */
return;
}
/* put them back to the range as sequences */
for (i = 0; i < count; i++) {
if (seq1 != 0) {
}
/* make sure the last message is in the range */
}
}
}
static void
struct mail_search_arg *arg,
bool change_uidsets,
{
struct mail_search_args *thread_args;
const char *keywords[2];
case SEARCH_UIDSET:
if (change_uidsets) T_BEGIN {
} T_END;
break;
case SEARCH_MODSEQ:
break;
/* modseq with keyword */
case SEARCH_KEYWORDS:
keywords);
break;
case SEARCH_INTHREAD:
if (thread_args == NULL) {
struct mail_search_args, 1);
/* simplification should have unnested all
inthreads, so we'll assume that
have_inthreads=FALSE */
}
thread_args->refcount++;
/* fall through */
case SEARCH_SUB:
case SEARCH_OR:
break;
default:
break;
}
}
}
{
if (args->init_refcount++ > 0) {
return;
}
if (!args->simplified)
}
struct mail_search_arg *arg)
{
case SEARCH_MODSEQ:
case SEARCH_KEYWORDS:
break;
break;
case SEARCH_INTHREAD:
}
/* fall through */
case SEARCH_SUB:
case SEARCH_OR:
break;
default:
break;
}
}
}
{
if (--args->init_refcount > 0)
return;
}
struct mail_search_arg *arg,
{
case SEARCH_SEQSET:
/* replace sequences with UIDs in the existing array.
this way it's possible to switch between uidsets and
seqsets constantly without leaking memory */
break;
case SEARCH_SUB:
case SEARCH_OR:
case SEARCH_INTHREAD:
uids);
break;
default:
break;
}
}
}
{
T_BEGIN {
} T_END;
}
{
}
{
return;
}
}
static struct mail_search_arg *
{
struct mail_search_arg *new_arg;
case SEARCH_INTHREAD:
/* fall through */
case SEARCH_OR:
case SEARCH_SUB:
break;
case SEARCH_ALL:
break;
case SEARCH_SEQSET:
case SEARCH_UIDSET:
break;
case SEARCH_FLAGS:
break;
case SEARCH_BEFORE:
case SEARCH_ON:
case SEARCH_SINCE:
case SEARCH_SENTBEFORE:
case SEARCH_SENTON:
case SEARCH_SENTSINCE:
break;
case SEARCH_SMALLER:
case SEARCH_LARGER:
break;
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
/* fall through */
case SEARCH_KEYWORDS:
case SEARCH_BODY:
case SEARCH_TEXT:
case SEARCH_BODY_FAST:
case SEARCH_TEXT_FAST:
case SEARCH_GUID:
case SEARCH_MAILBOX:
break;
case SEARCH_MODSEQ:
break;
}
return new_arg;
}
static struct mail_search_arg *
{
}
return new_arg;
}
struct mail_search_args *
{
struct mail_search_args *new_args;
return new_args;
}
{
if (!args->match_always)
else {
if (!full_reset)
else {
}
}
}
}
void *context)
{
struct mail_search_arg *subarg;
return;
/* sublist of conditions */
/* didn't match */
break;
}
}
/* OR-list of conditions */
/* matched */
break;
}
}
} else {
/* just a single condition */
}
}
void *context)
{
int result;
result = 1;
/* didn't match */
return 0;
}
result = -1;
}
return result;
}
static void
{
static const char *date_hdr = "Date";
struct mail_search_arg *subarg;
return;
case SEARCH_OR:
case SEARCH_SUB:
}
}
break;
case SEARCH_SENTBEFORE:
case SEARCH_SENTON:
case SEARCH_SENTSINCE:
break;
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
sizeof(const char *));
break;
case SEARCH_BODY:
case SEARCH_BODY_FAST:
break;
case SEARCH_TEXT:
case SEARCH_TEXT_FAST:
break;
default:
break;
}
}
const char *const *
bool *have_headers, bool *have_body)
{
bool have_text;
return NULL;
}
static struct mail_keywords *
struct mail_keywords **_kw1,
struct mail_keywords **_kw2)
{
struct mail_keywords *new_kw;
T_BEGIN {
unsigned int i, j;
/* don't add duplicates */
break;
}
}
&new_indexes);
} T_END;
return new_kw;
}
static void
{
/* neg(p and q and ..) == neg(p) or neg(q) or ..
neg(p or q or ..) == neg(p) and neg(q) and .. */
}
/* p and (q and ..) == p and q and ..
p or (q or ..) == p or q or ..
(p) = p */
continue;
}
}
/* merge all flags arguments */
if (prev_flags_arg == NULL)
else {
continue;
}
!parent_and) {
if (prev_not_flags_arg == NULL)
else {
continue;
}
}
/* merge all keywords arguments */
if (prev_kw_arg == NULL)
prev_kw_arg = args;
else {
continue;
}
!parent_and) {
if (prev_not_kw_arg == NULL)
else {
continue;
}
}
}
}
static bool
struct mail_search_arg **argp,
bool parent_inthreads, bool parent_and)
{
case SEARCH_SUB:
case SEARCH_OR:
} else {
}
break;
case SEARCH_INTHREAD:
/* children converted to SEARCH_INTHREADs */
}
break;
default:
break;
}
}
return FALSE;
/* put all non-INTHREADs under a single INTHREAD */
}
}
if (!parent_and) {
/* We want to OR the args */
}
return TRUE;
}
{
/* we may have added some extra SUBs that could be dropped */
}
}
const struct mail_search_arg *arg2)
{
return FALSE;
case SEARCH_OR:
case SEARCH_SUB:
case SEARCH_ALL:
return TRUE;
case SEARCH_SEQSET:
/* sequences may point to different messages at different times,
never assume they match */
return FALSE;
case SEARCH_UIDSET:
case SEARCH_FLAGS:
case SEARCH_KEYWORDS:
case SEARCH_BEFORE:
case SEARCH_ON:
case SEARCH_SINCE:
case SEARCH_SENTBEFORE:
case SEARCH_SENTON:
case SEARCH_SENTSINCE:
case SEARCH_SMALLER:
case SEARCH_LARGER:
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
return FALSE;
/* fall through */
case SEARCH_BODY:
case SEARCH_TEXT:
case SEARCH_BODY_FAST:
case SEARCH_TEXT_FAST:
case SEARCH_GUID:
case SEARCH_MAILBOX:
/* don't bother doing case-insensitive comparison. it must not
full i18n case-insensitivity (or the active comparator
in future). */
case SEARCH_MODSEQ: {
}
case SEARCH_INTHREAD:
}
i_unreached();
return FALSE;
}
const struct mail_search_arg *arg2)
{
return FALSE;
}
}
const struct mail_search_args *args2)
{
return FALSE;
}