]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Support UID-less saves/copies after all. Virtual backend can't return them.
authorTimo Sirainen <tss@iki.fi>
Fri, 31 Jul 2009 02:07:15 +0000 (22:07 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 31 Jul 2009 02:07:15 +0000 (22:07 -0400)
--HG--
branch : HEAD

src/imap/cmd-append.c
src/imap/cmd-copy.c

index f879cd366a3725781bde2090165d219e3da830f1..e6e52310c5f13a6218fdae94572edc793aee4d6a 100644 (file)
@@ -216,6 +216,7 @@ static bool cmd_append_continue_parsing(struct client_command_context *cmd)
        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(struct client_command_context *cmd)
                        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) {
index 7c606482876cca22948756cd285068162128a3e7..4658a68ea8399e8c8e49013f02cd5aa4d0b42da7 100644 (file)
@@ -146,9 +146,14 @@ bool cmd_copy(struct client_command_context *cmd)
                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,