mbox-sync-list-index.c revision 53cc097d3f8cd789f3c8fa0dfdd02bcda776230e
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch/* Copyright (c) 2013-2014 Dovecot authors, see the included COPYING file */
d39a04db2f4d0599cb9b5f03a9aa10a3c234453cTimo Sirainenstatic unsigned int
f7423cbbd9dea363a5df18ebb96da055a977ae79Timo Sirainenmbox_list_get_ext_id(struct mbox_mailbox *mbox,
a3fe8c0c54d87822f4b4f8f0d10caac611861b2bTimo Sirainen if (mbox->mbox_list_index_ext_id == (uint32_t)-1) {
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen mail_index_ext_register(mail_index_view_get_index(view),
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainenint mbox_list_index_has_changed(struct mailbox *box,
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)box;
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen ret = index_storage_list_index_has_changed(box, list_view, seq);
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen if (ret != 0 || box->storage->set->mailbox_list_index_very_dirty_syncs)
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen ext_id = mbox_list_get_ext_id(mbox, list_view);
86791365b10f45982c88e70f2eb94fd6c3fea151Timo Sirainen mail_index_lookup_ext(list_view, seq, ext_id, &data, &expunged);
86791365b10f45982c88e70f2eb94fd6c3fea151Timo Sirainen if (rec == NULL || expunged || rec->mtime == 0) {
4d4d6d4745682790c20d759ba93dbea46b812c5dTimo Sirainen /* doesn't exist or not synced */
2f94ca6b0f70641fe31c8e1f93404ca0df8bb289Timo Sirainen ret = mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_MAILBOX, &path);
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen rec->size != (uint32_t)(st.st_size & 0xffffffffU))
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainenvoid mbox_list_index_update_sync(struct mailbox *box,
f46363f428d8f2784146d36692b21936a48a7006Timo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)box;
f46363f428d8f2784146d36692b21936a48a7006Timo Sirainen const struct mbox_index_header *mhdr = &mbox->mbox_hdr;
ccf50662cc02b5e703039a4ff7f91a4470e25b71Timo Sirainen index_storage_list_index_update_sync(box, trans, seq);
2f94ca6b0f70641fe31c8e1f93404ca0df8bb289Timo Sirainen /* get the current record */
2f94ca6b0f70641fe31c8e1f93404ca0df8bb289Timo Sirainen list_view = mail_index_transaction_get_view(trans);
2f94ca6b0f70641fe31c8e1f93404ca0df8bb289Timo Sirainen ext_id = mbox_list_get_ext_id(mbox, list_view);
ccf50662cc02b5e703039a4ff7f91a4470e25b71Timo Sirainen mail_index_lookup_ext(list_view, seq, ext_id, &data, &expunged);
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen memcmp(old_rec, &new_rec, sizeof(*old_rec)) != 0)