The previous change guarantees it.
struct cydir_mailbox *mbox = (struct cydir_mailbox *)box;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (index_mailbox_want_full_sync(&mbox->box, flags) && ret == 0)
+ if (index_mailbox_want_full_sync(&mbox->box, flags))
ret = cydir_sync(mbox);
return index_mailbox_sync_init(box, flags, ret < 0);
enum mdbox_sync_flags mdbox_sync_flags = 0;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (ret == 0 && (index_mailbox_want_full_sync(&mbox->box, flags) ||
- mbox->storage->corrupted))
+ if (index_mailbox_want_full_sync(&mbox->box, flags) ||
+ mbox->storage->corrupted)
ret = mdbox_deleted_sync(mbox, mdbox_sync_flags);
return index_mailbox_sync_init(box, flags, ret < 0);
enum mdbox_sync_flags mdbox_sync_flags = 0;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (box->opened) {
- if (mail_index_reset_fscked(box->index))
- mdbox_storage_set_corrupted(mbox->storage);
- }
- if (ret == 0 && (index_mailbox_want_full_sync(&mbox->box, flags) ||
- mbox->storage->corrupted)) {
+ if (mail_index_reset_fscked(box->index))
+ mdbox_storage_set_corrupted(mbox->storage);
+ if (index_mailbox_want_full_sync(&mbox->box, flags) ||
+ mbox->storage->corrupted) {
if ((flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0)
mdbox_sync_flags |= MDBOX_SYNC_FLAG_FORCE_REBUILD;
ret = mdbox_sync(mbox, mdbox_sync_flags);
enum sdbox_sync_flags sdbox_sync_flags = 0;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (ret == 0 && mail_index_reset_fscked(box->index))
+ if (mail_index_reset_fscked(box->index))
sdbox_set_mailbox_corrupted(box);
- if (ret == 0 && (index_mailbox_want_full_sync(&mbox->box, flags) ||
- mbox->corrupted_rebuild_count != 0)) {
+ if (index_mailbox_want_full_sync(&mbox->box, flags) ||
+ mbox->corrupted_rebuild_count != 0) {
if ((flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0)
sdbox_sync_flags |= SDBOX_SYNC_FLAG_FORCE_REBUILD;
ret = sdbox_sync(mbox, sdbox_sync_flags);
list->refreshed_mailboxes_recently = FALSE;
}
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (ret == 0)
- imapc_noop_if_needed(mbox, flags);
+ imapc_noop_if_needed(mbox, flags);
if (imapc_mailbox_commit_delayed_trans(mbox, &changes) < 0)
ret = -1;
bool lost_files, force_resync;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- return index_mailbox_sync_init(box, flags, TRUE);
- }
-
force_resync = (flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0;
if (index_mailbox_want_full_sync(&mbox->box, flags)) {
ret = maildir_sync_run(mbox, flags, force_resync,
enum mbox_sync_flags mbox_sync_flags = 0;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (index_mailbox_want_full_sync(&mbox->box, flags) && ret == 0) {
+ if (index_mailbox_want_full_sync(&mbox->box, flags)) {
if ((flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0 &&
!mbox->storage->set->mbox_very_dirty_syncs)
mbox_sync_flags |= MBOX_SYNC_UNDIRTY;
struct pop3c_mailbox *mbox = (struct pop3c_mailbox *)box;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- } else {
- if ((flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0 &&
- mbox->msg_uidls == NULL) {
- /* FIXME: reconnect */
- }
+ if ((flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0 &&
+ mbox->msg_uidls == NULL) {
+ /* FIXME: reconnect */
}
- if (ret == 0)
- ret = pop3c_sync(mbox);
-
+ ret = pop3c_sync(mbox);
return index_mailbox_sync_init(box, flags, ret < 0);
}
struct raw_mailbox *mbox = (struct raw_mailbox *)box;
int ret = 0;
- if (!box->opened) {
- if (mailbox_open(box) < 0)
- ret = -1;
- }
-
- if (!mbox->synced && ret == 0)
+ if (!mbox->synced)
ret = raw_sync(mbox);
return index_mailbox_sync_init(box, flags, ret < 0);