Mercurial > dovecot > core-2.2
changeset 22418:cbd8f0cb2ce4
virtual: Sync backend flags on initial sync when UIDVALIDITY hasn't changed
Before recent fixes the UIDVALIDITY was thought to change almost every time,
so this bug wasn't visible.
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Wed, 26 Jul 2017 12:53:16 +0300 |
parents | e4c084e70fb6 |
children | 55bd9d8ca7ce |
files | src/plugins/virtual/virtual-sync.c |
diffstat | 1 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-sync.c Wed Jul 26 13:35:36 2017 +0300 +++ b/src/plugins/virtual/virtual-sync.c Wed Jul 26 12:53:16 2017 +0300 @@ -643,6 +643,38 @@ } } +static void +virtual_sync_mailbox_box_update_flags(struct virtual_sync_context *ctx, + struct virtual_backend_box *bbox, + const ARRAY_TYPE(seq_range) *uids_arr) +{ + unsigned int i, uid, vseq; + struct virtual_backend_uidmap *vuid; + struct seq_range_iter iter; + + i = 0; + seq_range_array_iter_init(&iter, uids_arr); + while(seq_range_array_iter_nth(&iter, i++, &uid)) { + vuid = array_bsearch(&bbox->uids, &uid, + virtual_backend_uidmap_bsearch_cmp); + if (vuid == NULL || + vuid->virtual_uid == 0 || + !mail_index_lookup_seq(ctx->sync_view, + vuid->virtual_uid, &vseq)) { + /* the entry has been already removed either by + us or some other session. doesn't matter, + we don't need to update the flags. + + it might also have not yet been assigned a uid + so we don't want to update the flags then either. + */ + continue; + } + virtual_sync_external_flags(ctx, bbox, vseq, + vuid->real_uid); + } +} + static int virtual_backend_uidmap_cmp(const struct virtual_backend_uidmap *u1, const struct virtual_backend_uidmap *u2) { @@ -824,6 +856,7 @@ &removed_uids); } virtual_sync_mailbox_box_add(ctx, bbox, &added_uids); + virtual_sync_mailbox_box_update_flags(ctx, bbox, &flag_update_uids); bbox->search_result = result; return 0;