cmd-store.c revision 9293bf90039454f47e94e4ba3722a775cfa7d25c
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "seq-range-array.h"
#include "str.h"
#include "commands.h"
#include "imap-search.h"
#include "imap-util.h"
#include <stdlib.h>
struct imap_store_context {
struct client_command_context *cmd;
const char *messageset;
enum mail_flags flags;
struct mail_keywords *keywords;
enum modify_type modify_type;
bool silent;
};
static bool
{
if (*type == '+') {
type++;
} else if (*type == '-') {
type++;
} else {
}
return FALSE;
return FALSE;
return TRUE;
}
static bool
{
const char *name;
"STORE modifiers contain non-atoms.");
return FALSE;
}
args++;
ctx->max_modseq =
} else {
"Unknown STORE modifier");
return FALSE;
}
}
return TRUE;
}
static bool
{
const char *type;
const char *const *keywords_list = NULL;
return FALSE;
args++;
}
return FALSE;
}
return FALSE;
} else {
return FALSE;
}
/* invalid keywords */
return FALSE;
}
}
return TRUE;
}
{
struct mail_search_arg *search_arg;
struct mail_search_context *search_ctx;
struct mailbox_transaction_context *t;
struct imap_store_context ctx;
enum mailbox_transaction_flags flags = 0;
const char *tagged_reply;
bool failed;
return FALSE;
if (!client_verify_open_mailbox(cmd))
return TRUE;
return TRUE;
if (search_arg == NULL)
return TRUE;
/* FIXME: UNCHANGEDSINCE should be atomic, but this requires support
from mail-storage API. So for now we fake it. */
continue;
}
}
}
}
if (!array_is_created(&modified_set))
tagged_reply = "OK Store completed.";
else {
}
if (mailbox_search_deinit(&search_ctx) < 0) {
} else {
failed = mailbox_transaction_commit(&t) < 0;
}
if (!failed) {
/* With UID STORE we have to return UID for the flags as well.
Unfortunately we don't have the ability to separate those
flag changes that were caused by UID STORE and those that
came externally, so we'll just send the UID for all flag
changes that we see. */
enum imap_sync_flags imap_sync_flags = 0;
MAILBOX_FEATURE_CONDSTORE) != 0))
} else {
return TRUE;
}
}