cmd-store.c revision 9261dbf0675204898c6557591c7aa376e23a52b2
/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
#include "imap-common.h"
#include "seq-range-array.h"
#include "str.h"
#include "imap-commands.h"
#include "imap-search-args.h"
#include "imap-util.h"
#include <stdlib.h>
struct imap_store_context {
struct client_command_context *cmd;
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
{
"Invalid STORE modifiers.");
return FALSE;
}
"Invalid modseq");
return FALSE;
}
} else {
"Unknown STORE modifier");
return FALSE;
}
}
return TRUE;
}
static bool
{
const char *type;
const char *const *keywords_list = NULL;
return FALSE;
args++;
}
return FALSE;
}
args++;
return FALSE;
} else {
return FALSE;
}
/* invalid keywords */
return FALSE;
}
}
return TRUE;
}
{
struct mail_search_args *search_args;
struct mail_search_context *search_ctx;
struct mailbox_transaction_context *t;
struct imap_store_context ctx;
enum mailbox_transaction_flags flags = 0;
enum imap_sync_flags imap_sync_flags = 0;
int ret;
return FALSE;
if (!client_verify_open_mailbox(cmd))
return TRUE;
return TRUE;
}
if (ret <= 0)
return ret < 0;
return TRUE;
if (client->mailbox_examined) {
reply = "NO CONDSTORE failed: Mailbox is read-only.";
else
reply = "OK Store ignored with read-only mailbox.";
0, reply);
}
/* update modseqs so we can check them early */
}
/* STORE UNCHANGEDSINCE is being used */
&modified_set);
}
/* check early so there's less work for transaction
commit if something has to be cancelled */
continue;
}
}
}
}
if (ret < 0)
else
ret = mailbox_transaction_commit(&t);
if (ret < 0) {
return TRUE;
}
if (array_count(&modified_set) == 0)
tagged_reply = "OK Store completed.";
else {
&uids);
modified_set = uids;
}
}
/* 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. */
MAILBOX_FEATURE_CONDSTORE) != 0))
}