From: Timo Sirainen Date: Fri, 24 Jan 2020 09:43:20 +0000 (+0200) Subject: imap: copy/move: Move code to cmd_move_send_untagged() X-Git-Tag: 2.3.10~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f28d187052885c29b7409f4613c78e658d793f61;p=thirdparty%2Fdovecot%2Fcore.git imap: copy/move: Move code to cmd_move_send_untagged() --- diff --git a/src/imap/cmd-copy.c b/src/imap/cmd-copy.c index 2061a24ee5..130a3d6baf 100644 --- a/src/imap/cmd-copy.c +++ b/src/imap/cmd-copy.c @@ -163,6 +163,18 @@ static int fetch_and_copy(struct cmd_copy_context *copy_ctx, return ret; } +static void cmd_move_send_untagged(struct cmd_copy_context *copy_ctx, + string_t *msg, string_t *src_uidset) +{ + if (array_count(©_ctx->saved_uids) == 0) + return; + str_printfa(msg, "* OK [COPYUID %u %s ", + copy_ctx->uid_validity, str_c(src_uidset)); + imap_write_seq_range(msg, ©_ctx->saved_uids); + str_append(msg, "] Moved UIDs."); + client_send_line(copy_ctx->cmd->client, str_c(msg)); +} + static bool cmd_copy_full(struct client_command_context *cmd, bool move) { struct client *client = cmd->client; @@ -232,12 +244,7 @@ static bool cmd_copy_full(struct client_command_context *cmd, bool move) str_append(msg, move ? "OK Move completed." : "OK Copy completed."); } else if (move) { - str_printfa(msg, "* OK [COPYUID %u %s ", - copy_ctx.uid_validity, str_c(src_uidset)); - imap_write_seq_range(msg, ©_ctx.saved_uids); - str_append(msg, "] Moved UIDs."); - client_send_line(client, str_c(msg)); - + cmd_move_send_untagged(©_ctx, msg, src_uidset); str_truncate(msg, 0); str_append(msg, "OK Move completed."); } else {