From: Timo Sirainen Date: Mon, 25 Dec 2017 17:33:33 +0000 (+0200) Subject: imapc: Keep "selected" state TRUE only while mailbox is successfully SELECTed X-Git-Tag: 2.2.34~131 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d5bebb26131aa438fbaed1cfe4ef9c6b006af732;p=thirdparty%2Fdovecot%2Fcore.git imapc: Keep "selected" state TRUE only while mailbox is successfully SELECTed --- diff --git a/src/lib-storage/index/imapc/imapc-storage.c b/src/lib-storage/index/imapc/imapc-storage.c index 387bf79779..ed94d37e32 100644 --- a/src/lib-storage/index/imapc/imapc-storage.c +++ b/src/lib-storage/index/imapc/imapc-storage.c @@ -577,8 +577,10 @@ imapc_mailbox_reopen_callback(const struct imapc_command_reply *reply, mbox->selecting = FALSE; if (reply->state != IMAPC_COMMAND_STATE_OK) errmsg = reply->text_full; - else if (imapc_mailbox_verify_select(mbox, &errmsg)) + else if (imapc_mailbox_verify_select(mbox, &errmsg)) { errmsg = NULL; + mbox->selected = TRUE; + } if (errmsg != NULL) { imapc_client_mailbox_reconnect(mbox->client_box, @@ -609,6 +611,7 @@ static void imapc_mailbox_reopen(void *context) mbox->initial_sync_done = FALSE; mbox->selecting = TRUE; + mbox->selected = FALSE; mbox->exists_received = FALSE; cmd = imapc_client_mailbox_cmd(mbox->client_box, @@ -635,7 +638,6 @@ imapc_mailbox_open_callback(const struct imapc_command_reply *reply, const char *error; ctx->mbox->selecting = FALSE; - ctx->mbox->selected = TRUE; if (reply->state == IMAPC_COMMAND_STATE_OK) { if (!imapc_mailbox_verify_select(ctx->mbox, &error)) { mail_storage_set_critical(ctx->mbox->box.storage, @@ -643,6 +645,7 @@ imapc_mailbox_open_callback(const struct imapc_command_reply *reply, ctx->mbox->box.name, error); ctx->ret = -1; } else { + ctx->mbox->selected = TRUE; ctx->ret = 0; } } else if (reply->state == IMAPC_COMMAND_STATE_NO) {