dovecot-2.0: lib-storage: Use mail->saving, not mail->uid==0 to ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 28 23:34:50 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/267ad2b32276
changeset: 11650:267ad2b32276
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 28 21:34:45 2010 +0100
description:
lib-storage: Use mail->saving, not mail->uid==0 to check if mail is being saved.
The uid may be non-zero when saving with dsync.

diffstat:

 src/lib-storage/index/index-mail.c           |   2 +-
 src/lib-storage/index/maildir/maildir-mail.c |  10 +++++-----
 src/plugins/zlib/zlib-plugin.c               |   2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diffs (72 lines):

diff -r 6cce8b2a9121 -r 267ad2b32276 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c	Mon Jun 28 17:58:47 2010 +0100
+++ b/src/lib-storage/index/index-mail.c	Mon Jun 28 21:34:45 2010 +0100
@@ -1320,7 +1320,7 @@
 		/* open the stream only if we didn't get here from
 		   mailbox_save_init() */
 		hdr = mail_index_get_header(_mail->box->view);
-		if (_mail->uid != 0 && _mail->uid < hdr->next_uid)
+		if (!_mail->saving && _mail->uid < hdr->next_uid)
 			(void)mail_get_stream(_mail, NULL, NULL, &input);
 	}
 }
diff -r 6cce8b2a9121 -r 267ad2b32276 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Mon Jun 28 17:58:47 2010 +0100
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Mon Jun 28 21:34:45 2010 +0100
@@ -118,7 +118,7 @@
 		if (stp == NULL)
 			return -1;
 		*st = *stp;
-	} else if (mail->uid != 0) {
+	} else if (!mail->saving) {
 		imail->mail.stats_stat_lookup_count++;
 		ret = maildir_file_do(mbox, mail->uid, do_stat, st);
 		if (ret <= 0) {
@@ -274,7 +274,7 @@
 	enum maildir_uidlist_rec_ext_key key;
 	const char *path, *fname, *value;
 
-	if (_mail->uid != 0) {
+	if (!_mail->saving) {
 		if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
 			return -1;
 	} else {
@@ -292,7 +292,7 @@
 		return 1;
 
 	/* size can be included in uidlist entry */
-	if (_mail->uid != 0) {
+	if (!_mail->saving) {
 		key = vsize ? MAILDIR_UIDLIST_REC_EXT_VSIZE :
 			MAILDIR_UIDLIST_REC_EXT_PSIZE;
 		value = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
@@ -411,7 +411,7 @@
 		return 0;
 	}
 
-	if (_mail->uid != 0) {
+	if (!_mail->saving) {
 		ret = maildir_file_do(mbox, _mail->uid, do_stat, &st);
 		if (ret <= 0) {
 			if (ret == 0)
@@ -450,7 +450,7 @@
 			*value_r = mail->data.guid;
 			return 0;
 		}
-		if (_mail->uid != 0) {
+		if (!_mail->saving) {
 			if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
 				return -1;
 		} else {
diff -r 6cce8b2a9121 -r 267ad2b32276 src/plugins/zlib/zlib-plugin.c
--- a/src/plugins/zlib/zlib-plugin.c	Mon Jun 28 17:58:47 2010 +0100
+++ b/src/plugins/zlib/zlib-plugin.c	Mon Jun 28 21:34:45 2010 +0100
@@ -143,7 +143,7 @@
 	   in such situation we're probably checking if the user-given input
 	   looks compressed */
 	if (imail->data.stream != NULL ||
-	    (_mail->uid == 0 && zuser->save_handler == NULL)) {
+	    (_mail->saving && zuser->save_handler == NULL)) {
 		return zmail->super.get_stream(_mail, hdr_size, body_size,
 					       stream_r);
 	}


More information about the dovecot-cvs mailing list