index-sync-search.c revision 5cbab0cb665cd982855d9d87573c35706e4d992c
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "seq-range-array.h"
#include "mail-search.h"
#include "mailbox-search-result-private.h"
#include "index-sync-private.h"
static void
unsigned int *pos,
{
unsigned int i, count;
}
i++;
}
}
/* finished this range */
if (++i < count)
else {
/* this was the last searched message */
seq = 0;
}
}
*pos = i;
}
static int
{
struct mailbox_transaction_context *t;
struct mail_search_context *search_ctx;
const struct seq_range *search_seqs;
int ret;
seqpos = 0;
/* tell search that we're updating an existing search result,
so it can do some optimizations based on it */
/* some messages in search_seqs didn't match.
make sure they don't exist in the search result. */
}
next_seq++;
} else {
/* this was the last searched message */
next_seq = 0;
}
/* match - make sure it exists in search result */
}
/* last message(s) didn't match. make sure they don't exist
in the search result. */
&next_seq,
}
if (mailbox_transaction_commit(&t) < 0)
ret = -1;
return ret;
}
static bool
struct mail_search_result *result,
{
/* @UNSAFE */
unsigned int count;
!result->args_have_modseq) {
/* search result doesn't care about flag changes */
return FALSE;
}
if (count == 0) {
/* no changes */
return FALSE;
}
/* merge the changed sequences */
return TRUE;
}
static int
{
struct mail_search_arg search_arg;
int ret;
/* add a temporary search parameter to limit the search only to
the changed messages */
return ret;
}
static int
unsigned int old_messages_count,
struct mail_search_result *result)
{
struct mailbox_transaction_context *t;
struct mail_search_context *search_ctx;
struct mail_search_arg search_arg;
int ret;
if (old_messages_count == message_count) {
/* no new messages */
return 0;
}
/* add a temporary search parameter to limit the search only to
the new messages */
/* add all messages matching the search to search result */
if (mailbox_transaction_commit(&t) < 0)
ret = -1;
return ret;
}
static void
struct mail_search_result *result)
{
/* not an updateable search result */
return;
}
T_BEGIN {
} T_END;
result);
}
{
struct mail_search_result *const *results;
unsigned int i, count;
for (i = 0; i < count; i++)
}
{
unsigned int i, count;
return;
for (i = 0; i < count; i++) {
}
}
}