Mercurial > dovecot > core-2.2
changeset 13541:645a56f9d8ee
iampc: Small code cleanup.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 22 Sep 2011 14:21:56 +0300 |
parents | 00b6848a5a63 |
children | b6633cb57814 |
files | src/lib-storage/index/imapc/imapc-mailbox.c src/lib-storage/index/imapc/imapc-storage.c src/lib-storage/index/imapc/imapc-storage.h |
diffstat | 3 files changed, 24 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mailbox.c Thu Sep 22 13:09:18 2011 +0300 +++ b/src/lib-storage/index/imapc/imapc-mailbox.c Thu Sep 22 14:21:56 2011 +0300 @@ -116,7 +116,7 @@ if (view == NULL) view = imapc_mailbox_get_sync_view(mbox); - if (mbox->opening) { + if (mbox->selecting) { /* We don't know the latest flags, refresh them. */ mbox->sync_fetch_first_uid = 1; } else if (mbox->sync_fetch_first_uid != 1) {
--- a/src/lib-storage/index/imapc/imapc-storage.c Thu Sep 22 13:09:18 2011 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.c Thu Sep 22 14:21:56 2011 +0300 @@ -382,11 +382,30 @@ imapc_client_stop(ctx->mbox->storage->client); } +static int imapc_mailbox_select(struct imapc_mailbox *mbox) +{ + struct imapc_open_context ctx; + bool examine; + + examine = (mbox->box.flags & MAILBOX_FLAG_READONLY) != 0 && + (mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) == 0; + + mbox->selecting = TRUE; + ctx.mbox = mbox; + ctx.ret = -2; + mbox->client_box = + imapc_client_mailbox_open(mbox->storage->client, mbox->box.name, + examine, imapc_mailbox_open_callback, + &ctx, mbox); + while (ctx.ret == -2) + imapc_storage_run(mbox->storage); + mbox->selecting = FALSE; + return ctx.ret; +} + static int imapc_mailbox_open(struct mailbox *box) { struct imapc_mailbox *mbox = (struct imapc_mailbox *)box; - struct imapc_open_context ctx; - bool examine; if (index_storage_mailbox_open(box, FALSE) < 0) return -1; @@ -395,8 +414,6 @@ /* We don't actually want to SELECT the mailbox. */ return 0; } - examine = (box->flags & MAILBOX_FLAG_READONLY) != 0 && - (box->flags & MAILBOX_FLAG_DROP_RECENT) == 0; if (*box->name == '\0' && (box->list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0) { @@ -408,17 +425,7 @@ return -1; } - mbox->opening = TRUE; - ctx.mbox = mbox; - ctx.ret = -2; - mbox->client_box = - imapc_client_mailbox_open(mbox->storage->client, box->name, - examine, imapc_mailbox_open_callback, - &ctx, mbox); - while (ctx.ret == -2) - imapc_storage_run(mbox->storage); - mbox->opening = FALSE; - if (ctx.ret < 0) { + if (imapc_mailbox_select(mbox) < 0) { mailbox_close(box); return -1; }
--- a/src/lib-storage/index/imapc/imapc-storage.h Thu Sep 22 13:09:18 2011 +0300 +++ b/src/lib-storage/index/imapc/imapc-storage.h Thu Sep 22 14:21:56 2011 +0300 @@ -68,7 +68,7 @@ uint32_t prev_skipped_rseq, prev_skipped_uid; - unsigned int opening:1; + unsigned int selecting:1; unsigned int syncing:1; unsigned int initial_sync_done:1; };