/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "imap-arg.h"
#include "imap-seqset.h"
#include "imap-util.h"
#include "mail-search.h"
#include "imapc-msgmap.h"
#include "imapc-storage.h"
#include "imapc-search.h"
struct imapc_search_context {
unsigned int n;
bool finished;
bool success;
};
static bool
const struct mail_search_arg *args,
{
case SEARCH_OR:
case SEARCH_SUB:
return FALSE;
break;
case SEARCH_ALL:
case SEARCH_SEQSET:
case SEARCH_UIDSET:
case SEARCH_FLAGS:
case SEARCH_KEYWORDS:
case SEARCH_MODSEQ:
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
case SEARCH_REAL_UID:
break;
default:
return FALSE;
}
}
return TRUE;
}
static bool
const struct mail_search_arg *arg,
{
const char *error;
case SEARCH_OR:
return TRUE;
case SEARCH_SUB:
return TRUE;
case SEARCH_SEQSET:
/* translate to UIDs */
T_BEGIN {
&uids);
} T_END;
return TRUE;
case SEARCH_BEFORE:
case SEARCH_SINCE:
/* a bit kludgy way to check this.. */
return FALSE;
return FALSE;
return TRUE;
}
/* fall through */
case SEARCH_ALL:
case SEARCH_UIDSET:
case SEARCH_FLAGS:
case SEARCH_KEYWORDS:
case SEARCH_ON:
case SEARCH_SMALLER:
case SEARCH_LARGER:
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
case SEARCH_BODY:
case SEARCH_TEXT:
/* extensions */
case SEARCH_MODSEQ:
return FALSE;
case SEARCH_INTHREAD:
case SEARCH_GUID:
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
case SEARCH_REAL_UID:
case SEARCH_MIMEPART:
/* not supported for now */
break;
}
return FALSE;
}
static bool
const struct mail_search_arg *args,
{
return FALSE;
}
return TRUE;
}
const struct mail_search_args *args,
const char **query_r)
{
/* SEARCH command passthrough not enabled */
return FALSE;
}
return FALSE;
else
return FALSE;
return TRUE;
}
void *context)
{
} else {
}
}
struct mail_search_context *
struct mail_search_args *args,
const enum mail_sort_type *sort_program,
struct mailbox_header_lookup_ctx *wanted_headers)
{
const char *search_query;
/* can't optimize this with SEARCH */
return ctx;
}
return ctx;
}
{
}
}
{
return index_storage_search_next_update_seq(ctx);
return FALSE;
return TRUE;
}
{
}
return index_storage_search_deinit(ctx);
}
struct imapc_mailbox *mbox)
{
const char *atom;
i_error("Unexpected SEARCH reply");
return;
}
/* we're doing UID SEARCH, so need to convert UIDs to sequences */
i_error("Invalid SEARCH reply");
break;
}
}
}
struct imapc_mailbox *mbox)
{
const char *atom;
i_error("Unexpected ESEARCH reply");
return;
}
/* It should contain ALL <seqset> or nonexistent if nothing matched */
i_error("Invalid ESEARCH reply");
}