Mercurial > dovecot > core-2.2
changeset 9706:fb8f0a3d51dc HEAD
imap: Support UID-less saves/copies after all. Virtual backend can't return them.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 30 Jul 2009 22:07:15 -0400 |
parents | 497b17e8bb91 |
children | 20934905ccdc |
files | src/imap/cmd-append.c src/imap/cmd-copy.c |
diffstat | 2 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ 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) {
--- 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 @@ 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,