]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Propagate cmd_tag to notify_progress()
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 24 Feb 2023 09:33:54 +0000 (09:33 +0000)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 22 May 2023 09:21:43 +0000 (09:21 +0000)
src/imap/imap-client.c
src/imap/imap-storage-callbacks.c

index ddbff61a695bf34b40d4061f3654d46b7c5ee773..6d70a8e82d2043a77cd293f5ac786b3b10f332cc 100644 (file)
@@ -952,7 +952,7 @@ struct client_command_context *client_command_alloc(struct client *client)
 
 void client_command_init_finished(struct client_command_context *cmd)
 {
-       event_add_str(cmd->event, "cmd_tag", cmd->tag);
+       event_add_str(cmd->global_event, "cmd_tag", cmd->tag);
        /* use "unknown" until we checked that the command name is known/valid */
        event_add_str(cmd->event, "cmd_name", "unknown");
        /* the actual command name received from client - as-is */
index 402204873adbb1a641811a374201b0964437eea9..254fa0ba65839604cf7d740a65ff9b1eb2fb35b3 100644 (file)
@@ -42,6 +42,14 @@ static void notify_no(struct mailbox *mailbox ATTR_UNUSED,
        } T_END;
 }
 
+static const char *find_cmd_tag(struct event *event)
+{
+       const struct event_field *field =
+               event_find_field_recursive(event, "cmd_tag");
+       return field != NULL && field->value_type == EVENT_FIELD_VALUE_TYPE_STR ?
+              field->value.str : NULL;
+}
+
 const char *
 imap_storage_callback_line(const struct mail_storage_progress_details *dtl,
                           const char *tag)
@@ -112,7 +120,8 @@ int imap_notify_progress(const struct mail_storage_progress_details *dtl,
        int ret;
        T_BEGIN {
                bool corked = o_stream_is_corked(client->output);
-               const char *line = imap_storage_callback_line(dtl, NULL/*tag*/);
+               const char *tag = find_cmd_tag(event_get_global());
+               const char *line = imap_storage_callback_line(dtl, tag);
 
                client_send_line(client, line);
                ret = o_stream_uncork_flush(client->output);