[dovecot-cvs] dovecot/src/lib-index mail-index-transaction-view.c, 1.19, 1.20
cras at dovecot.org
cras at dovecot.org
Wed Aug 2 22:41:30 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv7142
Modified Files:
mail-index-transaction-view.c
Log Message:
Transaction view: mail_index_get_header() returns now updated next_uid field
after appends.
Index: mail-index-transaction-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction-view.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mail-index-transaction-view.c 28 Jun 2006 16:31:05 -0000 1.19
+++ mail-index-transaction-view.c 2 Aug 2006 19:41:28 -0000 1.20
@@ -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,
More information about the dovecot-cvs
mailing list