[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-mail.c, 1.10, 1.11 mbox-save.c, 1.55, 1.56

cras at dovecot.org cras at dovecot.org
Thu Jul 8 23:26:19 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv1384/lib-storage/index/mbox

Modified Files:
	mbox-mail.c mbox-save.c 
Log Message:
Cache file fixes, API changes, etc. It's still in somewhat ugly state, but
getting better..



Index: mbox-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-mail.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mbox-mail.c	22 Jun 2004 07:36:33 -0000	1.10
+++ mbox-mail.c	8 Jul 2004 20:26:16 -0000	1.11
@@ -20,6 +20,9 @@
 	uint64_t offset;
 	int ret;
 
+	if (mail->data.deleted)
+		return 0;
+
 	if (ibox->mbox_lock_type == F_UNLCK) {
 		if (mbox_sync(ibox, FALSE, FALSE, TRUE) < 0)
 			return -1;
@@ -36,7 +39,9 @@
 	if (ret <= 0) {
 		if (ret < 0)
 			mail_storage_set_index_error(ibox);
-		return -1;
+		else
+			mail->data.deleted = TRUE;
+		return ret;
 	}
 
 	offset = *((const uint64_t *)data);
@@ -47,7 +52,7 @@
 		mail_index_mark_corrupted(ibox->index);
 		return -1;
 	}
-	return 0;
+	return 1;
 }
 
 static const struct mail_full_flags *mbox_mail_get_flags(struct mail *_mail)
@@ -74,7 +79,7 @@
 	if (data->received_date != (time_t)-1)
 		return data->received_date;
 
-	if (mbox_mail_seek(mail) < 0)
+	if (mbox_mail_seek(mail) <= 0)
 		return (time_t)-1;
 	data->received_date =
 		istream_raw_mbox_get_received_time(mail->ibox->mbox_stream);
@@ -84,9 +89,9 @@
 		data->received_date = 0;
 	}
 
-	index_mail_cache_add(mail, MAIL_CACHE_RECEIVED_DATE,
-			     &data->received_date,
-			     sizeof(data->received_date));
+	mail_cache_add(mail->trans->cache_trans, mail->data.seq,
+		       MAIL_CACHE_RECEIVED_DATE,
+		       &data->received_date, sizeof(data->received_date));
 	return data->received_date;
 }
 
@@ -96,7 +101,7 @@
 	struct index_mail *mail = (struct index_mail *)_mail;
 
 	if (field == MAIL_FETCH_FROM_ENVELOPE) {
-		if (mbox_mail_seek(mail) < 0)
+		if (mbox_mail_seek(mail) <= 0)
 			return NULL;
 
 		return istream_raw_mbox_get_sender(mail->ibox->mbox_stream);
@@ -116,10 +121,9 @@
 	uoff_t offset;
 
 	if (data->stream == NULL) {
-		if (mbox_mail_seek(mail) < 0)
+		if (mbox_mail_seek(mail) <= 0)
 			return NULL;
 
-		// FIXME: need to hide the headers
 		raw_stream = mail->ibox->mbox_stream;
 		offset = istream_raw_mbox_get_header_offset(raw_stream);
 		raw_stream = i_stream_create_limit(default_pool, raw_stream,

Index: mbox-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- mbox-save.c	3 Jul 2004 18:13:45 -0000	1.55
+++ mbox-save.c	8 Jul 2004 20:26:16 -0000	1.56
@@ -344,11 +344,7 @@
 	t_pop();
 
 	if (mail_r != NULL) {
-		const struct mail_index_record *rec;
-
-		if (mail_index_lookup(t->ictx.trans_view, seq, &rec) < 0)
-			return -1;
-		if (index_mail_next(&ctx->mail, rec, seq, FALSE) <= 0)
+		if (index_mail_next(&ctx->mail, seq) < 0)
 			return -1;
 		*mail_r = &ctx->mail.mail;
 	}



More information about the dovecot-cvs mailing list