cmd-search.c revision f0ac869b83bb915400fa163064ae70aebbe91833
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "ostream.h"
#include "str.h"
#include "commands.h"
#include "imap-search.h"
#define OUTBUF_SIZE 65536
struct imap_search_context {
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
struct mail_search_arg *sargs;
struct timeval start_time;
unsigned int output_sent:1;
};
static struct imap_search_context *
{
struct imap_search_context *ctx;
return ctx;
}
struct imap_search_context *ctx)
{
int ret;
ret = -1;
}
return ret;
}
{
bool tryagain;
int ret;
return TRUE;
}
&tryagain)) > 0) {
/* flush. this also causes us to lock the output. */
}
}
if (tryagain)
return FALSE;
}
ret = -1;
if (ret < 0) {
return TRUE;
}
t_strdup_printf("OK Search completed (%d.%03d secs).",
}
{
bool finished;
if (!finished)
(void)client_handle_unfinished_cmd(cmd);
else
(void)cmd_sync_delayed(client);
}
{
struct imap_search_context *ctx;
struct mail_search_arg *sargs;
int args_count;
if (args_count < 1) {
if (args_count == -2)
return FALSE;
"Missing SEARCH arguments.");
return TRUE;
}
if (!client_verify_open_mailbox(cmd))
return TRUE;
/* CHARSET specified */
args++;
"Invalid charset argument.");
return TRUE;
}
args++;
} else {
charset = "UTF-8";
}
/* error in search arguments */
return TRUE;
}
if (cmd_search_more(cmd))
return TRUE;
/* we could have moved onto syncing by now */
return FALSE;
}