virtual-sync.c revision 45312f52ff3a3d4c137447be4c7556500c2f8bf2
e59faf65ce864fe95dc00f5d52b8323cdbd0608aTimo Sirainen/* Copyright (c) 2008-2009 Dovecot authors, see the included COPYING file */
0f39a57760d93cddbce3ca43096d78e0fe2f42fdTimo Sirainen const char *const *kw_all;
58bc77731bb25e900498a28409337e747f622722Timo Sirainen /* messages expunged within this sync */
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen ARRAY_DEFINE(all_adds, struct virtual_add_record);
3cf67672fdc87583cb23ce088c95bb5dee60e74dTimo Sirainenstatic void virtual_sync_set_uidvalidity(struct virtual_sync_context *ctx)
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen offsetof(struct mail_index_header, uid_validity),
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainenstatic void virtual_sync_external_flags(struct virtual_sync_context *ctx,
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen const char *const *kw_names;
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen /* copy flags */
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen mail_index_update_flags(ctx->trans, vseq, MODIFY_REPLACE, flags);
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen /* copy keywords */
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen kw_names = mail_get_keywords(bbox->sync_mail);
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen keywords = mail_index_keywords_create(ctx->index, kw_names);
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen mail_index_update_keywords(ctx->trans, vseq, MODIFY_REPLACE, keywords);
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainenstatic int virtual_sync_mail_cmp(const void *p1, const void *p2)
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen const struct virtual_sync_mail *m1 = p1, *m2 = p2;
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen if (m1->vrec.mailbox_id < m2->vrec.mailbox_id)
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen if (m1->vrec.mailbox_id > m2->vrec.mailbox_id)
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainenvirtual_backend_box_sync_mail_set(struct virtual_backend_box *bbox)
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen trans = mailbox_transaction_begin(bbox->box, 0);
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainenvirtual_backend_box_sync_mail_unset(struct virtual_backend_box *bbox)
const void *ext_data;
bool ret;
return TRUE;
ext_name_offset = 0;
ext_mailbox_count = 0;
ext_mailbox_count = 0;
prev_mailbox_id = 0;
for (i = 0; i < ext_mailbox_count; i++) {
T_BEGIN {
const unsigned char *nameptr;
const char *name;
} T_END;
for (i = 0; i < count; i++) {
return ret;
const void *ext_data;
for (i = 0; i < count; i++) {
i_assert(i == 0 ||
sizeof(struct virtual_mail_index_record),
sizeof(uint32_t));
const void *data;
bool expunged;
if (flags != 0) {
if (flags != 0) {
kw_names);
kw_names);
keywords);
i_unreached();
int ret;
return ret;
const void *data;
unsigned int uid_count;
bool expunged;
unsigned int i, count;
for (i = 0; i < count; i++) {
old_msg_count = 0;
if (uid_count == 0)
sizeof(*uidmap),
i_unreached();
&vseq))
i_unreached();
if (uid_count == 0)
sizeof(*uidmap),
&dest))
i_unreached();
for (i = 0; i < uid_count; i++) {
&temp_uids);
&removed_uids);
&removed_uids);
unsigned int *idx1_r,
unsigned int *idx2_r)
return FALSE;
return TRUE;
case MAILBOX_SYNC_TYPE_FLAGS:
i_unreached();
case MAILBOX_SYNC_TYPE_MODSEQ:
const unsigned int uidval_pos =
unsigned int mailbox_offset;
int ret;
&status) < 0)
} T_END;
return ret;
const void *data;
bool expunged;
unsigned int j = 0, uidmap_count = 0;
for (i = 0; i < messages; i++) {
for (; j < uidmap_count; j++) {
&uidmap_count);
for (; j < uidmap_count; j++) {
for (; j < uidmap_count; j++) {
for (i = 0; i < count; i++) {
for (j = 0; j < uidmap_count; j++) {
unsigned int i, count;
i_unreached();
if (count == 0)
sizeof(*uidmap),
&idx))
i_unreached();
unsigned int i, count;
for (i = 0; i < count; i++) {
unsigned int i, count;
for (i = 0; i < count; i++)
if (success) {
return ret;
int ret;
if (ret <= 0) {
if (ret < 0)
return ret;
if (ret < 0)
struct mailbox_sync_context *
int ret = 0;