1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

relay: rename option relay.weechat.commands to relay.network.commands (issue #2066)

This commit is contained in:
Sébastien Helleu
2024-01-27 20:41:27 +01:00
parent f126255d6a
commit 70907fc169
5 changed files with 27 additions and 56 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ New features::
* core: use function util_strftimeval in evaluation of expression `date:xxx`
* api: add support of specifier `%!` for timestamp in function util_strftimeval
* api: add support of base64url in encode/decode functions
* relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string (issue #2066)
* relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string, rename option relay.weechat.commands to relay.network.commands (issue #2066)
* relay: add support of websocket extension "permessage-deflate" (issue #1549)
Bug fixes::
+4 -10
View File
@@ -480,7 +480,7 @@ error:
RELAY_API_PROTOCOL_CALLBACK(input)
{
cJSON *json_body, *json_buffer, *json_command;
const char *ptr_buffer_name, *ptr_command, *ptr_weechat_commands;
const char *ptr_buffer_name, *ptr_command, *ptr_commands;
struct t_gui_buffer *ptr_buffer;
struct t_hashtable *options;
@@ -541,15 +541,9 @@ RELAY_API_PROTOCOL_CALLBACK(input)
return WEECHAT_RC_OK;
}
ptr_weechat_commands = weechat_config_string (
relay_config_weechat_commands);
if (ptr_weechat_commands && ptr_weechat_commands[0])
{
weechat_hashtable_set (
options,
"commands",
weechat_config_string (relay_config_weechat_commands));
}
ptr_commands = weechat_config_string (relay_config_network_commands);
if (ptr_commands && ptr_commands[0])
weechat_hashtable_set (options, "commands", ptr_commands);
/*
* delay the execution of command after we go back in the WeeChat
+17 -33
View File
@@ -47,7 +47,6 @@ struct t_config_section *relay_config_section_look = NULL;
struct t_config_section *relay_config_section_color = NULL;
struct t_config_section *relay_config_section_network = NULL;
struct t_config_section *relay_config_section_irc = NULL;
struct t_config_section *relay_config_section_weechat = NULL;
struct t_config_section *relay_config_section_port = NULL;
struct t_config_section *relay_config_section_path = NULL;
@@ -74,6 +73,7 @@ struct t_config_option *relay_config_network_allowed_ips = NULL;
struct t_config_option *relay_config_network_auth_timeout = NULL;
struct t_config_option *relay_config_network_bind_address = NULL;
struct t_config_option *relay_config_network_clients_purge_delay = NULL;
struct t_config_option *relay_config_network_commands = NULL;
struct t_config_option *relay_config_network_compression = NULL;
struct t_config_option *relay_config_network_ipv6 = NULL;
struct t_config_option *relay_config_network_max_clients = NULL;
@@ -96,10 +96,6 @@ struct t_config_option *relay_config_irc_backlog_since_last_message = NULL;
struct t_config_option *relay_config_irc_backlog_tags = NULL;
struct t_config_option *relay_config_irc_backlog_time_format = NULL;
/* relay config, weechat section */
struct t_config_option *relay_config_weechat_commands = NULL;
/* other */
int relay_config_auto_open_buffer[RELAY_NUM_PROTOCOLS];
@@ -1288,6 +1284,22 @@ relay_config_init ()
"clients immediately, -1 = never purge)"),
NULL, -1, 60 * 24 * 30, "0", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_network_commands = weechat_config_new_option (
relay_config_file, relay_config_section_network,
"commands", "string",
N_("comma-separated list of commands allowed/denied when input "
"data (text or command) is received from a client (weechat "
"and api protocols); "
"\"*\" means any command, a name beginning with \"!\" is "
"a negative value to prevent a command from being executed, "
"wildcard \"*\" is allowed in names; this option should be set "
"if the relay client is not safe (someone could use it to run "
"commands); for example \"*,!exec,!quit\" allows any command "
"except /exec and /quit"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
relay_config_network_compression = weechat_config_new_option (
relay_config_file, relay_config_section_network,
"compression", "integer",
@@ -1478,34 +1490,6 @@ relay_config_init ()
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
/* section weechat */
relay_config_section_weechat = weechat_config_new_section (
relay_config_file, "weechat",
0, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (relay_config_section_weechat)
{
relay_config_weechat_commands = weechat_config_new_option (
relay_config_file, relay_config_section_weechat,
"commands", "string",
N_("comma-separated list of commands allowed/denied when input "
"data (text or command) is received from a client; "
"\"*\" means any command, a name beginning with \"!\" is "
"a negative value to prevent a command from being executed, "
"wildcard \"*\" is allowed in names; this option should be set "
"if the relay client is not safe (someone could use it to run "
"commands); for example \"*,!exec,!quit\" allows any command "
"except /exec and /quit"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
}
/* section port */
relay_config_section_port = weechat_config_new_section (
relay_config_file, "port",
+1 -2
View File
@@ -45,6 +45,7 @@ extern struct t_config_option *relay_config_network_allowed_ips;
extern struct t_config_option *relay_config_network_auth_timeout;
extern struct t_config_option *relay_config_network_bind_address;
extern struct t_config_option *relay_config_network_clients_purge_delay;
extern struct t_config_option *relay_config_network_commands;
extern struct t_config_option *relay_config_network_compression;
extern struct t_config_option *relay_config_network_ipv6;
extern struct t_config_option *relay_config_network_max_clients;
@@ -65,8 +66,6 @@ extern struct t_config_option *relay_config_irc_backlog_since_last_message;
extern struct t_config_option *relay_config_irc_backlog_tags;
extern struct t_config_option *relay_config_irc_backlog_time_format;
extern struct t_config_option *relay_config_weechat_commands;
extern int relay_config_auto_open_buffer[];
extern int relay_config_display_clients[];
extern regex_t *relay_config_regex_allowed_ips;
@@ -612,7 +612,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input)
{
struct t_gui_buffer *ptr_buffer;
struct t_hashtable *options;
const char *ptr_weechat_commands;
const char *ptr_commands;
char *pos;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(1);
@@ -648,15 +648,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input)
return WEECHAT_RC_OK;
}
ptr_weechat_commands = weechat_config_string (
relay_config_weechat_commands);
if (ptr_weechat_commands && ptr_weechat_commands[0])
{
weechat_hashtable_set (
options,
"commands",
weechat_config_string (relay_config_weechat_commands));
}
ptr_commands = weechat_config_string (relay_config_network_commands);
if (ptr_commands && ptr_commands[0])
weechat_hashtable_set (options, "commands", ptr_commands);
/*
* delay the execution of command after we go back in the WeeChat