Instead of calling sync_notify vfunc directly.
if (mail_index_transaction_commit(&trans) < 0)
return -1;
- if (box->v.sync_notify != NULL) {
- /* do notifications after commit finished successfully */
- box->tmp_sync_view = ctx->sync_view;
- seq_range_array_iter_init(&iter, &ctx->expunged_seqs); n = 0;
- while (seq_range_array_iter_nth(&iter, n++, &seq)) {
- mail_index_lookup_uid(ctx->sync_view, seq, &uid);
- box->v.sync_notify(box, uid, MAILBOX_SYNC_TYPE_EXPUNGE);
- }
- box->tmp_sync_view = NULL;
+ box->tmp_sync_view = ctx->sync_view;
+ seq_range_array_iter_init(&iter, &ctx->expunged_seqs); n = 0;
+ while (seq_range_array_iter_nth(&iter, n++, &seq)) {
+ mail_index_lookup_uid(ctx->sync_view, seq, &uid);
+ mailbox_sync_notify(box, uid, MAILBOX_SYNC_TYPE_EXPUNGE);
}
+ box->tmp_sync_view = NULL;
return 0;
}
array_free(&ctx->expunged_seqs);
}
- if (box->v.sync_notify != NULL)
- box->v.sync_notify(box, 0, 0);
+ mailbox_sync_notify(box, 0, 0);
return ret == 0 ? 1 :
(ctx->mbox->storage->corrupted ? 0 : -1);
ret = dbox_file_unlink(file);
/* do sync_notify only when the file was unlinked by us */
- if (ret > 0 && box->v.sync_notify != NULL)
- box->v.sync_notify(box, uid, MAILBOX_SYNC_TYPE_EXPUNGE);
+ if (ret > 0)
+ mailbox_sync_notify(box, uid, MAILBOX_SYNC_TYPE_EXPUNGE);
dbox_file_unref(&file);
}
array_foreach(&ctx->expunged_uids, uidp) T_BEGIN {
dbox_sync_file_expunge(ctx, *uidp);
} T_END;
- if (ctx->mbox->box.v.sync_notify != NULL)
- ctx->mbox->box.v.sync_notify(&ctx->mbox->box, 0, 0);
+ mailbox_sync_notify(&ctx->mbox->box, 0, 0);
ctx->mbox->box.tmp_sync_view = NULL;
}
imapc_sync_uid_next(ctx);
imapc_sync_highestmodseq(ctx);
- if (mbox->box.v.sync_notify != NULL)
- mbox->box.v.sync_notify(&mbox->box, 0, 0);
+ mailbox_sync_notify(&mbox->box, 0, 0);
if (!ctx->failed) {
/* reset only after a successful sync */
ctx->expunge_count++;
if (unlink(path) == 0) {
- if (box->v.sync_notify != NULL) {
- box->v.sync_notify(box, ctx->uid,
- MAILBOX_SYNC_TYPE_EXPUNGE);
- }
+ mailbox_sync_notify(box, ctx->uid, MAILBOX_SYNC_TYPE_EXPUNGE);
return 1;
}
if (errno == ENOENT)
return -1;
}
}
- if (box->v.sync_notify != NULL) {
- box->v.sync_notify(box, ctx->uid,
- index_sync_type_convert(sync_type));
- }
+ mailbox_sync_notify(box, ctx->uid, index_sync_type_convert(sync_type));
return 1;
}
ret = -1;
}
- if (mbox->box.v.sync_notify != NULL)
- mbox->box.v.sync_notify(&mbox->box, 0, 0);
+ mailbox_sync_notify(&mbox->box, 0, 0);
ctx->mbox->box.tmp_sync_view = NULL;
/* check cur/ mtime later. if we came here from saving messages they
mail->flags = flags | (mail->flags & MAIL_RECENT) |
MAIL_INDEX_MAIL_FLAG_DIRTY;
}
- if (sync_type != 0 && box->v.sync_notify != NULL) {
- box->v.sync_notify(box, mail_ctx->mail.uid,
+ if (sync_type != 0) {
+ mailbox_sync_notify(box, mail_ctx->mail.uid,
index_sync_type_convert(sync_type));
}
}
struct mbox_sync_context *sync_ctx = mail_ctx->sync_ctx;
struct mailbox *box = &sync_ctx->mbox->box;
- if (box->v.sync_notify != NULL) {
- box->v.sync_notify(box, mail_ctx->mail.uid,
- MAILBOX_SYNC_TYPE_EXPUNGE);
- }
+ mailbox_sync_notify(box, mail_ctx->mail.uid,
+ MAILBOX_SYNC_TYPE_EXPUNGE);
mail_index_expunge(sync_ctx->t, mail_ctx->mail.idx_seq);
mail_ctx->mail.expunged = TRUE;
}
}
- if (mbox->box.v.sync_notify != NULL)
- mbox->box.v.sync_notify(&mbox->box, 0, 0);
+ mailbox_sync_notify(&mbox->box, 0, 0);
return ret;
}
virtual_sync_ext_header_update(ctx);
}
- if (box->v.sync_notify != NULL)
- box->v.sync_notify(box, 0, 0);
+ mailbox_sync_notify(box, 0, 0);
}
static int virtual_sync_backend_box_init(struct virtual_backend_box *bbox)