diff options
author | Jari Matilainen <jari.matilainen@istone.se> | 2017-06-04 17:41:38 +0200 |
---|---|---|
committer | Jari Matilainen <jari.matilainen@istone.se> | 2017-06-04 17:41:38 +0200 |
commit | e84adeca15084a82c04ff6c3b5c7b8941c297322 (patch) | |
tree | f934c40f24d8faa1c51d94e240523c757509c4e4 /src/fe-common | |
parent | 0c26aeb9fc716416aa7dde2356cc59643f7cc793 (diff) | |
download | irssi-e84adeca15084a82c04ff6c3b5c7b8941c297322.zip |
change ternary operator to if/else statements, add default ssl port support
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/fe-server.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 46d25ae9..6e373139 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -119,10 +119,15 @@ static void cmd_server_add_modify(const char *data, gboolean add) if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); value = g_hash_table_lookup(optlist, "port"); - port = *portstr == '\0' ? - (value != NULL && *value != '\0' ? - atoi(value) : DEFAULT_SERVER_ADD_PORT) - : atoi(portstr); + + if (*portstr != '\0') + port = atoi(portstr); + else if (value != NULL && *value != '\0') + port = atoi(value); + else if (g_hash_table_lookup(optlist, "tls")) + port = DEFAULT_SERVER_ADD_TLS_PORT; + else + port = DEFAULT_SERVER_ADD_PORT; chatnet = g_hash_table_lookup(optlist, "network"); |