diff src/imap/cmd-append.c @ 6267:3a1eed408cad HEAD

mailbox_transaction_commit_get_uids() now returns also UIDVALIDITY. It's the only usable way to get it returned correctly. Removed maildir-specific mailbox_get_status() handling, it's supposed to return the current state of the mailbox, not the latest state. It was useful only for returning non-zero UIDVALIDITY for newly created mailboxes, and that's no longer needed.
author Timo Sirainen <tss@iki.fi>
date Sun, 12 Aug 2007 15:10:35 +0300
parents 6c0bfc35af03
children 913b188f4dd4
line wrap: on
line diff
--- a/src/imap/cmd-append.c	Sun Aug 12 15:05:13 2007 +0300
+++ b/src/imap/cmd-append.c	Sun Aug 12 15:10:35 2007 +0300
@@ -235,8 +235,7 @@
 	if (args->type == IMAP_ARG_EOL) {
 		/* last message */
 		enum mailbox_sync_flags sync_flags;
-		struct mailbox_status status;
-		uint32_t uid1, uid2;
+		uint32_t uid_validity, uid1, uid2;
 		const char *msg;
 
 		/* eat away the trailing CRLF */
@@ -249,6 +248,7 @@
 		}
 
 		ret = mailbox_transaction_commit_get_uids(&ctx->t, 0,
+							  &uid_validity,
 							  &uid1, &uid2);
 		if (ret < 0) {
 			client_send_storage_error(cmd, ctx->storage);
@@ -257,17 +257,14 @@
 		}
 		i_assert(ctx->count == uid2 - uid1 + 1);
 
-		if (mailbox_get_status(ctx->box, STATUS_UIDVALIDITY,
-				       &status) < 0)
-			msg = "OK Append completed.";
-		else if (uid1 == uid2) {
+		if (uid1 == uid2) {
 			msg = t_strdup_printf("OK [APPENDUID %u %u] "
 					      "Append completed.",
-					      status.uidvalidity, uid1);
+					      uid_validity, uid1);
 		} else {
 			msg = t_strdup_printf("OK [APPENDUID %u %u:%u] "
 					      "Append completed.",
-					      status.uidvalidity, uid1, uid2);
+					      uid_validity, uid1, uid2);
 		}
 
 		sync_flags = ctx->box == cmd->client->mailbox ?