]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Split off client_args_finished()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 Nov 2019 12:26:40 +0000 (14:26 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 11 Nov 2019 08:32:03 +0000 (10:32 +0200)
src/imap/imap-client.c
src/imap/imap-client.h

index 59d0844d7670cbfddb426a409dc0d79be5b87f6c..6646844fca67f1c51f316e34128aafa2c6959e3a 100644 (file)
@@ -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,
index 866513cb30aaaf6d4837088bb18b3012b4fd9ba1..557d7d9f5876860b45d7ef7e7332c094b5244def 100644 (file)
@@ -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. */