Skip to content

Commit

Permalink
lib-index: Fix next_uid lookup in open transaction that has appended …
Browse files Browse the repository at this point in the history
…mails

The appended mails were used for returning an updated
mail_index_header.next_uid, but only if the mails were assigned UIDs in
mail_index_append(). It should have updated the next_uid also after
mail_index_append_finish_uids() was used to assign the UIDs.

This fixes setting first_recent_uid correctly for virtual mailboxes when the
sync finds new mails. Avoids multiple sessions from getting \Recent flags
for the same mails.
  • Loading branch information
sirainen authored and cmouse committed Jul 20, 2017
1 parent bf2fa36 commit 7e4af98
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib-index/mail-index-transaction-update.c
Expand Up @@ -223,6 +223,8 @@ void mail_index_append_finish_uids(struct mail_index_transaction *t,
if (recs[i].uid == 0 || recs[i].uid < first_uid) {
i_assert(next_uid < (uint32_t)-1);
recs[i].uid = next_uid++;
if (t->highest_append_uid < recs[i].uid)
t->highest_append_uid = recs[i].uid;
} else {
if (next_uid != first_uid)
t->appends_nonsorted = TRUE;
Expand Down

0 comments on commit 7e4af98

Please sign in to comment.