diff options
author | Jari Matilainen <jari.matilainen@istone.se> | 2017-05-11 14:02:23 +0200 |
---|---|---|
committer | Jari Matilainen <jari.matilainen@istone.se> | 2017-05-11 14:02:23 +0200 |
commit | 25f9c71f690f9fd846a39e646fbd11f715ffbfa5 (patch) | |
tree | 128e67bc59696232fce42bdfaac43cf31a28a0c8 /src/fe-common/core | |
parent | c890ecafa0ce3df1a339ae201598184ab1585d36 (diff) | |
download | irssi-25f9c71f690f9fd846a39e646fbd11f715ffbfa5.zip |
Allow -port <num> or irc.host.tld <port num> in /server add and /server modify
Diffstat (limited to 'src/fe-common/core')
-rw-r--r-- | src/fe-common/core/fe-server.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index f4c1d3ee..89d6f739 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -117,7 +117,11 @@ static void cmd_server_add_modify(const char *data, gboolean add) return; if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - port = *portstr == '\0' ? DEFAULT_SERVER_ADD_PORT : atoi(portstr); + + value = g_hash_table_lookup(optlist, "port"); + port = *portstr == '\0' ? + (value != NULL && *value != '\0' ? atoi(value) : DEFAULT_SERVER_ADD_PORT) + : atoi(portstr); chatnet = g_hash_table_lookup(optlist, "network"); @@ -137,11 +141,7 @@ static void cmd_server_add_modify(const char *data, gboolean add) return; } rec->address = g_strdup(addr); - rec->port = port; } else { - value = g_hash_table_lookup(optlist, "port"); - if (value != NULL && *value != '\0') rec->port = atoi(value); - if (*password != '\0') g_free_and_null(rec->password); if (g_hash_table_lookup(optlist, "host")) { g_free_and_null(rec->own_host); @@ -149,6 +149,8 @@ static void cmd_server_add_modify(const char *data, gboolean add) } } + rec->port = port; + if (g_hash_table_lookup(optlist, "6")) rec->family = AF_INET6; else if (g_hash_table_lookup(optlist, "4")) |