dovecot-2.2: virtual: If backend mailbox hasn't changed, we stil...
dovecot at dovecot.org
dovecot at dovecot.org
Thu May 15 10:27:20 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/e99cd21e1f92
changeset: 17382:e99cd21e1f92
user: Timo Sirainen <tss at iki.fi>
date: Thu May 15 13:26:40 2014 +0300
description:
virtual: If backend mailbox hasn't changed, we still need to build its uidmap.
diffstat:
src/plugins/virtual/virtual-sync.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diffs (71 lines):
diff -r c22c139b2823 -r e99cd21e1f92 src/plugins/virtual/virtual-sync.c
--- a/src/plugins/virtual/virtual-sync.c Wed May 14 12:46:25 2014 +0300
+++ b/src/plugins/virtual/virtual-sync.c Thu May 15 13:26:40 2014 +0300
@@ -664,8 +664,10 @@
uidmap.virtual_uid = vuid;
array_append(&bbox->uids, &uidmap, 1);
- if (mail_index_lookup_seq(bbox->box->view,
- vrec->real_uid, &seq)) {
+ if (result == NULL)
+ ;
+ else if (mail_index_lookup_seq(bbox->box->view,
+ vrec->real_uid, &seq)) {
seq_range_array_add(&result->uids,
vrec->real_uid);
} else {
@@ -1069,7 +1071,12 @@
status.uidnext == bbox->sync_next_uid &&
status.highest_modseq == bbox->sync_highest_modseq) {
/* mailbox hasn't changed since we last opened it,
- skip it for now. */
+ skip it for now.
+
+ we'll still need to create the bbox->uids mapping
+ using the current index. */
+ if (array_count(&bbox->uids) == 0)
+ virtual_sync_backend_handle_old_vmsgs(ctx, bbox, NULL);
return 0;
}
if (!bbox_index_opened) {
@@ -1091,6 +1098,7 @@
/* build the initial search using the saved modseq. */
ret = virtual_sync_backend_box_continue(ctx, bbox);
}
+ i_assert(bbox->search_result != NULL || ret < 0);
} else {
/* sync using the existing search result */
i_assert(bbox_index_opened);
@@ -1144,6 +1152,8 @@
if (bbox == NULL || bbox->mailbox_id != vrec->mailbox_id) {
/* add the rest of the newly seen messages */
+ i_assert(j == uidmap_count ||
+ bbox->search_result != NULL);
for (; j < uidmap_count; j++) {
add_rec.rec.real_uid = uidmap[j].real_uid;
array_append(&ctx->all_adds, &add_rec, 1);
@@ -1163,6 +1173,7 @@
}
if (bbox->search_result == NULL) {
/* mailbox is completely unchanged since last sync */
+ j = uidmap_count;
continue;
}
mail_index_lookup_uid(ctx->sync_view, vseq, &vuid);
@@ -1254,6 +1265,7 @@
if (bbox == NULL || bbox->mailbox_id != vrec->mailbox_id) {
bbox = virtual_backend_box_lookup(ctx->mbox,
vrec->mailbox_id);
+ i_assert(bbox->search_result != NULL);
}
if (!mail_set_uid(bbox->sync_mail, vrec->real_uid))
i_unreached();
@@ -1299,6 +1311,7 @@
if (bbox == NULL || bbox->mailbox_id != vrec->mailbox_id) {
bbox = virtual_backend_box_lookup(ctx->mbox,
vrec->mailbox_id);
+ i_assert(bbox->search_result != NULL);
}
mail_index_append(ctx->trans, 0, &vseq);
More information about the dovecot-cvs
mailing list