1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

relay: evaluate path of unix socket relay

This commit is contained in:
Sébastien Helleu
2019-05-12 21:53:23 +02:00
parent b228ccdfc3
commit 585eb337e8
4 changed files with 28 additions and 23 deletions
+5 -2
View File
@@ -396,7 +396,7 @@ relay_command_init ()
"relay",
N_("relay control"),
N_("list|listfull|listrelay"
" || add <name> <port>"
" || add <name> <port>|<path>"
" || del|start|restart|stop <name>"
" || raw"
" || sslcertkey"),
@@ -411,6 +411,9 @@ relay_command_init ()
" stop: close the server socket (clients remain connected)\n"
" name: relay name (see format below)\n"
" port: port used for relay\n"
" path: path used for relay (for UNIX domain socket only); "
"\"%h\" at beginning of string is replaced by WeeChat home "
"(\"~/.weechat\" by default), content is evaluated (see /help eval)\n"
" raw: open buffer with raw Relay data\n"
" sslcertkey: set SSL certificate/key using path in option "
"relay.network.ssl_cert_key\n"
@@ -453,7 +456,7 @@ relay_command_init ()
" weechat protocol with SSL, using IPv4 + IPv6:\n"
" /relay add ipv4.ipv6.ssl.weechat 9001\n"
" weechat protocol over UNIX domain socket:\n"
" /relay add unix.weechat /tmp/weesock"),
" /relay add unix.weechat %h/relay_socket"),
"list %(relay_relays)"
" || listfull %(relay_relays)"
" || listrelay"
+6 -2
View File
@@ -764,7 +764,10 @@ relay_config_create_option_port_path (const void *pointer, void *data,
{
weechat_config_new_option (
config_file, section,
option_name, "string", NULL,
option_name, "string",
_("path to a socket file; \"%h\" at beginning of string "
"is replaced by WeeChat home (\"~/.weechat\" by default), "
"content is evaluated (see /help eval)"),
NULL, 0, 0, "", value, 0,
&relay_config_check_path_cb, NULL, NULL,
&relay_config_change_path_cb, NULL, NULL,
@@ -774,7 +777,8 @@ relay_config_create_option_port_path (const void *pointer, void *data,
{
weechat_config_new_option (
config_file, section,
option_name, "integer", NULL,
option_name, "integer",
_("port for relay"),
NULL, 0, 65535, "", value, 0,
&relay_config_check_port_cb, NULL, NULL,
&relay_config_change_port_cb, NULL, NULL,
+7 -9
View File
@@ -711,7 +711,8 @@ relay_server_new (const char *protocol_string, enum t_relay_protocol protocol,
new_server->protocol_args =
(protocol_args) ? strdup (protocol_args) : NULL;
new_server->port = port;
new_server->path = strdup (path);
new_server->path = weechat_string_eval_path_home (path,
NULL, NULL, NULL);
new_server->ipv4 = ipv4;
new_server->ipv6 = ipv6;
new_server->ssl = ssl;
@@ -748,14 +749,11 @@ relay_server_new (const char *protocol_string, enum t_relay_protocol protocol,
void
relay_server_update_path (struct t_relay_server *server, const char *path)
{
if (strcmp (path, server->path) != 0)
{
relay_server_close_socket (server);
free (server->path);
server->path = strdup (path);
server->port = -1;
relay_server_create_socket (server);
}
relay_server_close_socket (server);
free (server->path);
server->path = weechat_string_eval_path_home (path, NULL, NULL, NULL);
server->port = -1;
relay_server_create_socket (server);
}
/*