diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-10 10:17:51 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-12 20:37:48 +0100 |
commit | 0ac377d30674df75614b73d59a61175c27ae2317 (patch) | |
tree | 41c8109ecdeb9fa5297ee6b92aa03367203e96ad /src | |
parent | 59c977ddc9e5f7fdaa3a0dc0606ba86af8d7b941 (diff) | |
download | weechat-0ac377d30674df75614b73d59a61175c27ae2317.zip |
relay/api: add a global variable to customize the command delay in POST /api/input
The user can not change this, the variable will be set to 0 in unit tests to
execute the command immediately.
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/relay/api/relay-api-protocol.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/relay/api/relay-api-protocol.c b/src/plugins/relay/api/relay-api-protocol.c index 0cf6b8055..61b0b4a43 100644 --- a/src/plugins/relay/api/relay-api-protocol.c +++ b/src/plugins/relay/api/relay-api-protocol.c @@ -38,6 +38,8 @@ #include "relay-api-msg.h" #include "relay-api-protocol.h" +int relay_api_protocol_command_delay = 1; /* delay to execute command */ + /* * Callback for signals "buffer_*". @@ -463,6 +465,7 @@ RELAY_API_PROTOCOL_CALLBACK(input) const char *ptr_buffer_name, *ptr_command, *ptr_commands; struct t_gui_buffer *ptr_buffer; struct t_hashtable *options; + char str_delay[32]; json_body = cJSON_Parse(client->http_req->body); if (!json_body) @@ -534,7 +537,9 @@ RELAY_API_PROTOCOL_CALLBACK(input) * main loop (some commands like /upgrade executed now can cause * a crash) */ - weechat_hashtable_set (options, "delay", "1"); + snprintf (str_delay, sizeof (str_delay), + "%d", relay_api_protocol_command_delay); + weechat_hashtable_set (options, "delay", str_delay); /* execute the command, with the delay */ weechat_command_options (ptr_buffer, ptr_command, options); |