[dovecot-cvs] dovecot/src/lib-index mail-index-transaction-view.c, 1.16, 1.16.2.1

cras at dovecot.org cras at dovecot.org
Wed Aug 2 22:41:29 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv11516

Modified Files:
      Tag: branch_1_0
	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.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- mail-index-transaction-view.c	14 Jan 2006 18:47:34 -0000	1.16
+++ mail-index-transaction-view.c	2 Aug 2006 19:41:27 -0000	1.16.2.1
@@ -11,6 +11,8 @@
 	struct mail_index_view view;
 	struct mail_index_view_methods *parent;
 	struct mail_index_transaction *t;
+
+	struct mail_index_header hdr;
 };
 
 static void _tview_close(struct mail_index_view *view)
@@ -37,9 +39,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->parent->get_header(view);
+	hdr = tview->parent->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