[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-mail.c, 1.4, 1.5 maildir-save.c, 1.34, 1.35

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


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

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



Index: maildir-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-mail.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- maildir-mail.c	25 May 2004 14:16:55 -0000	1.4
+++ maildir-mail.c	8 Jul 2004 20:26:16 -0000	1.5
@@ -87,6 +87,11 @@
 	if (data->received_date != (time_t)-1)
 		return data->received_date;
 
+	if (data->open_mail && data->stream == NULL) {
+		/* we're going to open the mail anyway */
+		(void)_mail->get_stream(_mail, NULL, NULL);
+	}
+
 	if (data->stream != NULL) {
 		fd = i_stream_get_fd(data->stream);
 		i_assert(fd != -1);
@@ -103,8 +108,9 @@
 	}
 
 	data->received_date = st.st_mtime;
-	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;
 }
 
@@ -141,9 +147,9 @@
 		}
 
 		if (*p == ':' || *p == ',' || *p == '\0') {
-			index_mail_cache_add(mail, MAIL_CACHE_VIRTUAL_FULL_SIZE,
-					     &virtual_size,
-					     sizeof(virtual_size));
+			mail_cache_add(mail->trans->cache_trans, mail->data.seq,
+				       MAIL_CACHE_VIRTUAL_FULL_SIZE,
+				       &virtual_size, sizeof(virtual_size));
 			return virtual_size;
 		}
 	}
@@ -162,8 +168,10 @@
 	if (data->stream == NULL) {
 		data->stream = maildir_open_mail(mail->ibox, mail->mail.uid,
 						 &deleted);
-		if (data->stream == NULL)
+		if (data->stream == NULL) {
+			data->deleted = deleted;
 			return NULL;
+		}
 	}
 
 	return index_mail_init_stream(mail, hdr_size, body_size);

Index: maildir-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-save.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- maildir-save.c	3 Jul 2004 10:57:53 -0000	1.34
+++ maildir-save.c	8 Jul 2004 20:26:16 -0000	1.35
@@ -201,11 +201,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