dovecot-2.0: imap: Support UID-less saves/copies after all. Virt...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 31 05:10:21 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/fb8f0a3d51dc
changeset: 9706:fb8f0a3d51dc
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 30 22:07:15 2009 -0400
description:
imap: Support UID-less saves/copies after all. Virtual backend can't return them.

diffstat:

2 files changed, 19 insertions(+), 6 deletions(-)
src/imap/cmd-append.c |   16 ++++++++++++----
src/imap/cmd-copy.c   |    9 +++++++--

diffs (55 lines):

diff -r 497b17e8bb91 -r fb8f0a3d51dc src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Thu Jul 30 21:09:17 2009 -0400
+++ b/src/imap/cmd-append.c	Thu Jul 30 22:07:15 2009 -0400
@@ -216,6 +216,7 @@ static bool cmd_append_continue_parsing(
 	const char *internal_date_str;
 	time_t internal_date;
 	int ret, timezone_offset;
+	unsigned int save_count;
 	bool nonsync;
 
 	if (cmd->cancel) {
@@ -267,12 +268,19 @@ static bool cmd_append_continue_parsing(
 			cmd_append_finish(ctx);
 			return TRUE;
 		}
-		i_assert(ctx->count == seq_range_count(&changes.saved_uids));
 
 		msg = t_str_new(256);
-		str_printfa(msg, "OK [APPENDUID %u ", changes.uid_validity);
-		imap_write_seq_range(msg, &changes.saved_uids);
-		str_append(msg, "] Append completed.");
+		save_count = seq_range_count(&changes.saved_uids);
+		if (save_count == 0) {
+			/* not supported by backend (virtual) */
+			str_append(msg, "OK Append completed.");
+		} else {
+			i_assert(ctx->count == save_count);
+			str_printfa(msg, "OK [APPENDUID %u ",
+				    changes.uid_validity);
+			imap_write_seq_range(msg, &changes.saved_uids);
+			str_append(msg, "] Append completed.");
+		}
 		pool_unref(&changes.pool);
 
 		if (ctx->box == cmd->client->mailbox) {
diff -r 497b17e8bb91 -r fb8f0a3d51dc src/imap/cmd-copy.c
--- a/src/imap/cmd-copy.c	Thu Jul 30 21:09:17 2009 -0400
+++ b/src/imap/cmd-copy.c	Thu Jul 30 22:07:15 2009 -0400
@@ -146,9 +146,14 @@ bool cmd_copy(struct client_command_cont
 		mailbox_transaction_rollback(&t);
 	else if (mailbox_transaction_commit_get_changes(&t, &changes) < 0)
 		ret = -1;
-	else if (copy_count == 0)
+	else if (copy_count == 0) {
 		str_append(msg, "OK No messages copied.");
-	else {
+		pool_unref(&changes.pool);
+	} else if (seq_range_count(&changes.saved_uids) == 0) {
+		/* not supported by backend (virtual) */
+		str_append(msg, "OK Copy completed.");
+		pool_unref(&changes.pool);
+	} else {
 		i_assert(copy_count == seq_range_count(&changes.saved_uids));
 
 		str_printfa(msg, "OK [COPYUID %u %s ", changes.uid_validity,


More information about the dovecot-cvs mailing list