diff options
author | Jari Matilainen <jari.matilainen@istone.se> | 2017-05-15 23:07:01 +0200 |
---|---|---|
committer | Jari Matilainen <jari.matilainen@istone.se> | 2017-05-15 23:07:01 +0200 |
commit | 0c26aeb9fc716416aa7dde2356cc59643f7cc793 (patch) | |
tree | 3462345f8d6b4901b6a623623863ccdca420fa4c /src | |
parent | 4a6fbdbe7891859ffd7b51a87147ecb6158df141 (diff) | |
download | irssi-0c26aeb9fc716416aa7dde2356cc59643f7cc793.zip |
Make sure port is only set on /server modify if specified
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/fe-server.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 73c77e77..46d25ae9 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -120,7 +120,8 @@ static void cmd_server_add_modify(const char *data, gboolean add) value = g_hash_table_lookup(optlist, "port"); port = *portstr == '\0' ? - (value != NULL && *value != '\0' ? atoi(value) : DEFAULT_SERVER_ADD_PORT) + (value != NULL && *value != '\0' ? + atoi(value) : DEFAULT_SERVER_ADD_PORT) : atoi(portstr); chatnet = g_hash_table_lookup(optlist, "network"); @@ -141,7 +142,11 @@ static void cmd_server_add_modify(const char *data, gboolean add) return; } rec->address = g_strdup(addr); + rec->port = port; } else { + if (*portstr != '\0' || g_hash_table_lookup(optlist, "port")) + rec->port = port; + if (*password != '\0') g_free_and_null(rec->password); if (g_hash_table_lookup(optlist, "host")) { g_free_and_null(rec->own_host); @@ -149,8 +154,6 @@ 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")) |