cmd-select.c revision d3280fe317a4598c0868cc440e7a1191c06d0db3
/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
#include "imap-common.h"
#include "seq-range-array.h"
#include "imap-commands.h"
#include "mail-search-build.h"
#include "imap-seqset.h"
#include "imap-fetch.h"
#include "imap-sync.h"
#include <stdlib.h>
struct imap_select_context {
struct client_command_context *cmd;
struct mail_namespace *ns;
struct imap_fetch_context *fetch_ctx;
unsigned int condstore:1;
};
{
struct seq_range_iter seq_iter;
/* change all n:m ranges to n,m and store the results */
for (i = 0; i < uid_count; i++) {
return -1;
if (diff > 0) {
n += diff - 1;
return -1;
}
}
return -1;
return 0;
}
static bool
{
const char *str;
"Invalid QRESYNC known-sequence-set");
return FALSE;
}
args++;
"Invalid QRESYNC known-uid-set");
return FALSE;
}
args++;
return FALSE;
}
if (!IMAP_ARG_IS_EOL(args)) {
"Too many parameters to QRESYNC known set");
return FALSE;
}
return TRUE;
}
static bool
{
const char *str;
unsigned int count;
MAILBOX_FEATURE_QRESYNC) == 0) {
return FALSE;
}
"QRESYNC parameters missing");
return FALSE;
}
"Invalid QRESYNC parameters");
return FALSE;
}
args += 2;
"Invalid QRESYNC known-uids");
return FALSE;
}
args++;
} else {
}
return FALSE;
args++;
}
if (!IMAP_ARG_IS_EOL(args)) {
"Invalid QRESYNC parameters");
return FALSE;
}
return TRUE;
}
static bool
{
const char *name;
while (!IMAP_ARG_IS_EOL(args)) {
"SELECT options contain non-atoms.");
return FALSE;
}
args++;
return FALSE;
args++;
} else {
"Unknown FETCH modifier");
return FALSE;
}
}
return TRUE;
}
{
}
{
if (ret < 0) {
} else {
"OK [READ-ONLY] Select completed." :
"OK [READ-WRITE] Select completed.");
}
}
{
int ret;
/* unfinished */
return FALSE;
}
if (ret < 0) {
}
return TRUE;
}
{
struct imap_fetch_context *fetch_ctx;
struct mail_search_args *search_args;
return -1;
(void)imap_fetch_deinit(fetch_ctx);
return -1;
}
if (imap_fetch_begin(fetch_ctx) == 0) {
if (imap_fetch_more(fetch_ctx) == 0) {
/* unfinished */
return 0;
}
}
}
static int
{
struct mailbox_status status;
enum mailbox_flags flags = 0;
int ret;
if (readonly)
return -1;
}
if (client->enabled_features != 0)
return -1;
}
STATUS_HIGHESTMODSEQ, &status) < 0) {
return -1;
}
client->select_counter++;
if (status.first_unseen_seq != 0) {
t_strdup_printf("* OK [UNSEEN %u] First unseen.",
}
t_strdup_printf("* OK [UIDVALIDITY %u] UIDs valid",
t_strdup_printf("* OK [UIDNEXT %u] Predicted next UID",
if (status.nonpermanent_modseqs) {
"* OK [NOMODSEQ] No permanent modsequences");
} else {
t_strdup_printf("* OK [HIGHESTMODSEQ %llu] Highest",
(unsigned long long)status.highest_modseq));
}
return -1;
}
} else {
ret = 1;
}
return ret;
}
{
return;
mailbox_free(&box);
/* CLOSED response is required by QRESYNC */
}
{
struct imap_select_context *ctx;
const char *mailbox, *storage_name;
int ret;
/* <mailbox> [(optional parameters)] */
return FALSE;
return FALSE;
}
return TRUE;
}
return TRUE;
}
}
/* Enable while no mailbox is opened to avoid sending
HIGHESTMODSEQ for previously opened mailbox */
}
if (ret == 0)
return FALSE;
return TRUE;
}
{
}