cmd = p_new(client->command_pool, struct client_command_context, 1);
cmd->client = client;
cmd->pool = client->command_pool;
+ cmd->event = event_create(client->event);
cmd->stats.start_time = ioloop_timeval;
cmd->stats.last_run_timeval = ioloop_timeval;
cmd->stats.start_ioloop_wait_usecs =
return cmd;
}
+void client_command_init_finished(struct client_command_context *cmd)
+{
+ event_add_str(cmd->event, "tag", cmd->tag);
+ event_add_str(cmd->event, "name", cmd->name);
+ if (cmd->args != NULL)
+ event_add_str(cmd->event, "args", cmd->args);
+ if (cmd->human_args != NULL)
+ event_add_str(cmd->event, "human_args", cmd->human_args);
+}
+
static struct client_command_context *
client_command_new(struct client *client)
{
client->input_lock = NULL;
if (client->mailbox_change_lock == cmd)
client->mailbox_change_lock = NULL;
+ event_unref(&cmd->event);
if (cmd->parser != NULL) {
if (client->free_parser == NULL) {
}
cmd->name = !cmd->uid ? p_strdup(cmd->pool, cmd->name) :
p_strconcat(cmd->pool, "UID ", cmd->name, NULL);
+ client_command_init_finished(cmd);
imap_refresh_proctitle();
}
struct client_command_context {
struct client_command_context *prev, *next;
struct client *client;
+ struct event *event;
pool_t pool;
/* IMAP command tag */
void client_search_updates_free(struct client *client);
struct client_command_context *client_command_alloc(struct client *client);
+void client_command_init_finished(struct client_command_context *cmd);
void client_command_cancel(struct client_command_context **cmd);
void client_command_free(struct client_command_context **cmd);
io_loop_time_refresh();
command_stats_start(cmd);
+ event_push_global(cmd->event);
cmd->executing = TRUE;
array_foreach(&command_hooks, hook)
hook->pre(cmd);
array_foreach(&command_hooks, hook)
hook->post(cmd);
cmd->executing = FALSE;
+ event_pop_global(cmd->event);
if (cmd->state == CLIENT_COMMAND_STATE_DONE)
finished = TRUE;
i_assert(command != NULL);
cmd->func = command->func;
cmd->cmd_flags = command->flags;
+ client_command_init_finished(cmd);
+
if (command_exec(cmd)) {
/* IDLE terminated because of an external change, but
DONE was already buffered */