diff options
-rw-r--r-- | src/common.h | 1 | ||||
-rw-r--r-- | src/fe-common/core/fe-server.c | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/common.h b/src/common.h index b6f9153e..ddbb1deb 100644 --- a/src/common.h +++ b/src/common.h @@ -9,6 +9,7 @@ #define IRSSI_ABI_VERSION 9 #define DEFAULT_SERVER_ADD_PORT 6667 +#define DEFAULT_SERVER_ADD_TLS_PORT 6697 #ifdef HAVE_CONFIG_H #include "irssi-config.h" 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"); |