diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-05-12 20:22:44 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-05-12 21:39:22 +0200 |
commit | 9d04bc5801920fb1e0ed9bad33a4a7e0d6ca83fd (patch) | |
tree | 57560d9e51de1adae33f5175a1ffe348e2520806 /src | |
parent | abe85999d81b5d8676718cbe7bf60d2ddc9a2efe (diff) | |
download | weechat-9d04bc5801920fb1e0ed9bad33a4a7e0d6ca83fd.zip |
relay: improve message displayed when the relay is added
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/relay/relay-command.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c index 20992b0fd..ed6f78114 100644 --- a/src/plugins/relay/relay-command.c +++ b/src/plugins/relay/relay-command.c @@ -194,8 +194,8 @@ relay_command_relay (const void *pointer, void *data, { struct t_relay_server *ptr_server; struct t_config_option *ptr_option; - struct t_config_section *port_path_section; char *path; + int unix_socket, rc; /* make C compiler happy */ (void) pointer; @@ -226,19 +226,21 @@ relay_command_relay (const void *pointer, void *data, { WEECHAT_COMMAND_MIN_ARGS(4, "add"); /* check if we're expecting a path or a port */ - port_path_section = (strncmp (argv[2], "unix.", 5) == 0) ? - relay_config_section_path : relay_config_section_port; - if (relay_config_create_option_port_path ( - NULL, NULL, - relay_config_file, - port_path_section, - argv[2], - argv_eol[3]) != WEECHAT_CONFIG_OPTION_SET_ERROR) + unix_socket = (strncmp (argv[2], "unix.", 5) == 0) ? 1 : 0; + rc = relay_config_create_option_port_path ( + NULL, NULL, + relay_config_file, + (unix_socket) ? relay_config_section_path : relay_config_section_port, + argv[2], + argv_eol[3]); + if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) { weechat_printf (NULL, - _("%s: relay \"%s\" (path/port: %s) added"), + _("%s: relay \"%s\" (%s: %s) added"), RELAY_PLUGIN_NAME, - argv[2], argv_eol[3]); + argv[2], + (unix_socket) ? _("path") : _("port"), + argv_eol[3]); } return WEECHAT_RC_OK; } |