Mercurial > dovecot > core-2.2
changeset 4528:74212d11b6b5 HEAD
Transaction view: mail_index_get_header() returns now updated next_uid field
after appends.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 02 Aug 2006 22:41:28 +0300 |
parents | 4c2155f3d72b |
children | 0ffb6fa11744 |
files | src/lib-index/mail-index-transaction-view.c |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-transaction-view.c Wed Aug 02 03:16:18 2006 +0300 +++ b/src/lib-index/mail-index-transaction-view.c Wed Aug 02 22:41:28 2006 +0300 @@ -12,6 +12,8 @@ struct mail_index_view view; struct mail_index_view_vfuncs *super; struct mail_index_transaction *t; + + struct mail_index_header hdr; }; static void _tview_close(struct mail_index_view *view) @@ -39,9 +41,24 @@ { struct mail_index_view_transaction *tview = (struct mail_index_view_transaction *)view; + const struct mail_index_header *hdr; + const struct mail_index_record *recs; + unsigned int count; /* FIXME: header counters may not be correct */ - return tview->super->get_header(view); + hdr = tview->super->get_header(view); + + if (array_is_created(&tview->t->appends)) { + /* update next_uid from appends, if UIDs have been given yet */ + recs = array_get(&tview->t->appends, &count); + if (count > 0 && recs[count-1].uid != 0) { + i_assert(recs[count-1].uid >= hdr->next_uid); + tview->hdr = *hdr; + tview->hdr.next_uid = recs[count-1].uid + 1; + hdr = &view->hdr; + } + } + return &tview->hdr; } static int _tview_lookup_full(struct mail_index_view *view, uint32_t seq,