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

tss-movial at dovecot.org tss-movial at dovecot.org
Mon Jun 12 15:27:31 EEST 2006


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

Modified Files:
	mail-index-transaction-view.c 
Log Message:
mail_index_lookup() and mail_index_lookup_full() returns now 0 if the mail has been expunged within the transaction.



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.17
diff -u -d -r1.16 -r1.17
--- mail-index-transaction-view.c	14 Jan 2006 18:47:34 -0000	1.16
+++ mail-index-transaction-view.c	12 Jun 2006 12:27:29 -0000	1.17
@@ -1,8 +1,9 @@
-/* Copyright (C) 2004 Timo Sirainen */
+/* Copyright (C) 2004-2006 Timo Sirainen */
 
 #include "lib.h"
 #include "array.h"
 #include "buffer.h"
+#include "seq-range-array.h"
 #include "mail-index-private.h"
 #include "mail-index-view-private.h"
 #include "mail-index-transaction-private.h"
@@ -48,6 +49,7 @@
 {
 	struct mail_index_view_transaction *tview =
                 (struct mail_index_view_transaction *)view;
+	int ret;
 
 	if (seq >= tview->t->first_new_seq) {
 		/* FIXME: is this right to return index map..?
@@ -55,9 +57,16 @@
 		*map_r = view->index->map;
 		*rec_r = mail_index_transaction_lookup(tview->t, seq);
 		return 1;
-	} else {
-		return tview->parent->lookup_full(view, seq, map_r, rec_r);
 	}
+
+	ret = tview->parent->lookup_full(view, seq, map_r, rec_r);
+	if (ret <= 0)
+		return ret;
+
+	/* if we're expunged within this transaction, return 0 */
+	return array_is_created(&tview->t->expunges) &&
+		seq_range_exists(&tview->t->expunges, seq) ? 0 : 1;
+
 }
 
 static int _tview_lookup_uid(struct mail_index_view *view, uint32_t seq,



More information about the dovecot-cvs mailing list