mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02:00
change ternary operator to if/else statements, add default ssl port support
This commit is contained in:
parent
0c26aeb9fc
commit
e84adeca15
2 changed files with 10 additions and 4 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
#define IRSSI_ABI_VERSION 9
|
#define IRSSI_ABI_VERSION 9
|
||||||
|
|
||||||
#define DEFAULT_SERVER_ADD_PORT 6667
|
#define DEFAULT_SERVER_ADD_PORT 6667
|
||||||
|
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "irssi-config.h"
|
#include "irssi-config.h"
|
||||||
|
|
|
||||||
|
|
@ -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);
|
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
|
|
||||||
value = g_hash_table_lookup(optlist, "port");
|
value = g_hash_table_lookup(optlist, "port");
|
||||||
port = *portstr == '\0' ?
|
|
||||||
(value != NULL && *value != '\0' ?
|
if (*portstr != '\0')
|
||||||
atoi(value) : DEFAULT_SERVER_ADD_PORT)
|
port = atoi(portstr);
|
||||||
: 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");
|
chatnet = g_hash_table_lookup(optlist, "network");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue