From: Timo Sirainen Date: Thu, 7 Nov 2019 12:26:40 +0000 (+0200) Subject: imap: Split off client_args_finished() X-Git-Tag: 2.3.10~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfd3e59912062b4d12d0fec5fe6cd44f543b1c4e;p=thirdparty%2Fdovecot%2Fcore.git imap: Split off client_args_finished() --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 59d0844d76..6646844fca 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -717,7 +717,6 @@ void client_send_internal_error(struct client_command_context *cmd) bool client_read_args(struct client_command_context *cmd, unsigned int count, unsigned int flags, const struct imap_arg **args_r) { - string_t *str; int ret; i_assert(count <= INT_MAX); @@ -728,16 +727,7 @@ bool client_read_args(struct client_command_context *cmd, unsigned int count, i_assert(cmd->client->input_lock == NULL || cmd->client->input_lock == cmd); - str = t_str_new(256); - imap_write_args(str, *args_r); - cmd->args = p_strdup(cmd->pool, str_c(str)); - event_add_str(cmd->event, "cmd_args", cmd->args); - - str_truncate(str, 0); - imap_write_args_for_human(str, *args_r); - cmd->human_args = p_strdup(cmd->pool, str_c(str)); - event_add_str(cmd->event, "cmd_human_args", cmd->human_args); - + client_args_finished(cmd, *args_r); cmd->client->input_lock = NULL; return TRUE; } else if (ret == -2) { @@ -788,6 +778,21 @@ bool client_read_string_args(struct client_command_context *cmd, return i == count; } +void client_args_finished(struct client_command_context *cmd, + const struct imap_arg *args) +{ + string_t *str = t_str_new(256); + + imap_write_args(str, args); + cmd->args = p_strdup(cmd->pool, str_c(str)); + event_add_str(cmd->event, "cmd_args", cmd->args); + + str_truncate(str, 0); + imap_write_args_for_human(str, args); + cmd->human_args = p_strdup(cmd->pool, str_c(str)); + event_add_str(cmd->event, "cmd_human_args", cmd->human_args); +} + static struct client_command_context * client_command_find_with_flags(struct client_command_context *new_cmd, enum command_flags flags, diff --git a/src/imap/imap-client.h b/src/imap/imap-client.h index 866513cb30..557d7d9f58 100644 --- a/src/imap/imap-client.h +++ b/src/imap/imap-client.h @@ -308,6 +308,8 @@ bool client_read_args(struct client_command_context *cmd, unsigned int count, store the arguments. */ bool client_read_string_args(struct client_command_context *cmd, unsigned int count, ...); +void client_args_finished(struct client_command_context *cmd, + const struct imap_arg *args); /* SEARCHRES extension: Call if $ is being used/updated, returns TRUE if we have to wait for an existing SEARCH SAVE to finish. */