[dovecot-cvs] dovecot/src/lib-storage/index index-storage.h, 1.122, 1.123 index-transaction.c, 1.20, 1.21

tss at dovecot.org tss at dovecot.org
Tue Apr 17 19:40:58 EEST 2007


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

Modified Files:
	index-storage.h index-transaction.c 
Log Message:
Added mailbox_transaction_commit_get_uids() which returns the UID range for
saved/copied messages.



Index: index-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- index-storage.h	17 Apr 2007 16:03:47 -0000	1.122
+++ index-storage.h	17 Apr 2007 16:40:56 -0000	1.123
@@ -82,6 +82,8 @@
 	struct mail_cache_view *cache_view;
 	struct mail_cache_transaction_ctx *cache_trans;
 
+	uint32_t first_saved_uid, last_saved_uid;
+
 	unsigned int cache_trans_failed:1;
 };
 
@@ -170,7 +172,9 @@
 index_transaction_begin(struct mailbox *box,
 			enum mailbox_transaction_flags flags);
 int index_transaction_commit(struct mailbox_transaction_context *t,
-			     enum mailbox_sync_flags flags);
+			     enum mailbox_sync_flags flags,
+			     uint32_t *first_saved_uid_r,
+			     uint32_t *last_saved_uid_r);
 void index_transaction_rollback(struct mailbox_transaction_context *t);
 
 bool index_keyword_array_cmp(const ARRAY_TYPE(keyword_indexes) *k1,

Index: index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-transaction.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- index-transaction.c	29 Mar 2007 11:51:25 -0000	1.20
+++ index-transaction.c	17 Apr 2007 16:40:56 -0000	1.21
@@ -77,8 +77,11 @@
 	it->flags = flags;
 	return &it->mailbox_ctx;
 }
+
 int index_transaction_commit(struct mailbox_transaction_context *_t,
-			     enum mailbox_sync_flags flags)
+			     enum mailbox_sync_flags flags,
+			     uint32_t *first_saved_uid_r,
+			     uint32_t *last_saved_uid_r)
 {
 	struct index_transaction_context *t =
 		(struct index_transaction_context *)_t;
@@ -87,7 +90,14 @@
 	uoff_t offset;
 
 	t->commit_flags = flags;
-	return mail_index_transaction_commit(&itrans, &seq, &offset);
+	if (mail_index_transaction_commit(&itrans, &seq, &offset) < 0)
+		return -1;
+
+	if (t->first_saved_uid <= t->last_saved_uid) {
+		*first_saved_uid_r = t->first_saved_uid;
+		*last_saved_uid_r = t->last_saved_uid;
+	}
+	return 0;
 }
 
 void index_transaction_rollback(struct mailbox_transaction_context *_t)



More information about the dovecot-cvs mailing list