cmd-select.c revision fed9ba3182e7dbfce7112e849ec0a632ef23299a
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo Sirainen/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainenstatic int select_qresync_get_uids(struct imap_select_context *ctx,
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen /* change all n:m ranges to n,m and store the results */
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen i_array_init(&ctx->qresync_sample_uidset, uid_count);
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen i_array_init(&ctx->qresync_sample_seqset, uid_count);
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen for (i = 0; i < uid_count; i++) {
73083841b92505091b7d1070554930651b91b701Aki Tuomi if (!seq_range_array_iter_nth(&seq_iter, n++, &seq))
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen array_append(&ctx->qresync_sample_seqset, &seq, 1);
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if (!seq_range_array_iter_nth(&seq_iter, n++, &seq))
099737facc44553349a15521cdfcc65b112054caTimo Sirainen array_append(&ctx->qresync_sample_seqset, &seq, 1);
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainenselect_parse_qresync_known_set(struct imap_select_context *ctx,
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen const char *str;
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen imap_seq_set_nostar_parse(str, &seqset) < 0) {
a05819736f348d0c5ac8b4966ac6b04c21e1a391Timo Sirainen "Invalid QRESYNC known-sequence-set");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen imap_seq_set_nostar_parse(str, &uidset) < 0) {
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen "Invalid QRESYNC known-uid-set");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if (select_qresync_get_uids(ctx, &seqset, &uidset) < 0) {
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen client_send_command_error(ctx->cmd, "Invalid QRESYNC sets");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen "Too many parameters to QRESYNC known set");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainenselect_parse_qresync(struct imap_select_context *ctx,
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen const char *str;
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen unsigned int count;
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen client_send_command_error(ctx->cmd, "QRESYNC not enabled");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if (!imap_arg_get_list_full(args, &args, &count)) {
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen "QRESYNC parameters missing");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen str_to_uint32(str, &ctx->qresync_uid_validity) < 0 ||
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen str_to_uint64(str, &ctx->qresync_modseq) < 0) {
00a50d6dc74e15b5b83afcb8c12c2109a2ca376dTimo Sirainen "Invalid QRESYNC parameters");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen if (imap_seq_set_nostar_parse(str, &ctx->qresync_known_uids) < 0) {
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen "Invalid QRESYNC known-uids");
7f7be2cbf68f8a202a688d5bc50f82483d461643Timo Sirainen seq_range_array_add_range(&ctx->qresync_known_uids,
return FALSE;
args++;
return FALSE;
return TRUE;
const char *name;
return FALSE;
args++;
return FALSE;
args++;
return FALSE;
return TRUE;
if (ret < 0) {
int ret;
return FALSE;
if (ret < 0) {
return TRUE;
return FALSE;
if (readonly)
int ret;
return FALSE;
return FALSE;
return TRUE;
switch (status) {
case MAILBOX_NAME_EXISTS_DIR:
case MAILBOX_NAME_VALID:
case MAILBOX_NAME_INVALID:
case MAILBOX_NAME_NOINFERIORS:
return TRUE;
return TRUE;
return TRUE;