Mercurial > dovecot > core-2.2
changeset 22344:9e3e89d1418d
virtual: Fix recent flag updates
View must be updated before looking up seqs
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Tue, 27 Jun 2017 14:19:16 +0300 |
parents | 27eb1b45aa02 |
children | 9c6f9b5ca1fa |
files | src/plugins/virtual/virtual-sync.c |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-sync.c Thu Jun 29 13:46:06 2017 +0300 +++ b/src/plugins/virtual/virtual-sync.c Tue Jun 27 14:19:16 2017 +0300 @@ -444,8 +444,11 @@ { struct mailbox *box = &ctx->mbox->box; const struct mail_index_header *hdr; + struct mail_index_view *view; uint32_t seq1, seq2; + view = mail_index_transaction_open_updated_view(ctx->trans); + hdr = mail_index_get_header(ctx->sync_view); if (hdr->uid_validity != 0) ctx->uid_validity = hdr->uid_validity; @@ -453,11 +456,14 @@ virtual_sync_set_uidvalidity(ctx); /* mark the newly seen messages as recent */ - if (mail_index_lookup_seq_range(ctx->sync_view, hdr->first_recent_uid, - hdr->next_uid, &seq1, &seq2)) { - mailbox_recent_flags_set_seqs(&ctx->mbox->box, ctx->sync_view, + if (mail_index_lookup_seq_range(view, hdr->first_recent_uid, + (uint32_t)-1, &seq1, &seq2)) { + mailbox_recent_flags_set_seqs(&ctx->mbox->box, view, seq1, seq2); } + + mail_index_view_close(&view); + if (ctx->ext_header_rewrite) { /* entire mailbox list needs to be rewritten */ virtual_sync_ext_header_rewrite(ctx);