mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #703 from vague666/server_modify_port
Allow -port <num> or irc.host.tld <num> in /server add
This commit is contained in:
commit
9d32636ebe
@ -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"
|
||||||
|
@ -117,7 +117,18 @@ static void cmd_server_add_modify(const char *data, gboolean add)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
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");
|
||||||
|
|
||||||
|
if (*portstr != '\0')
|
||||||
|
port = atoi(portstr);
|
||||||
|
else if (value != NULL && *value != '\0')
|
||||||
|
port = atoi(value);
|
||||||
|
else if (g_hash_table_lookup(optlist, "tls") ||
|
||||||
|
g_hash_table_lookup(optlist, "ssl"))
|
||||||
|
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");
|
||||||
|
|
||||||
@ -139,8 +150,8 @@ static void cmd_server_add_modify(const char *data, gboolean add)
|
|||||||
rec->address = g_strdup(addr);
|
rec->address = g_strdup(addr);
|
||||||
rec->port = port;
|
rec->port = port;
|
||||||
} else {
|
} else {
|
||||||
value = g_hash_table_lookup(optlist, "port");
|
if (*portstr != '\0' || g_hash_table_lookup(optlist, "port"))
|
||||||
if (value != NULL && *value != '\0') rec->port = atoi(value);
|
rec->port = port;
|
||||||
|
|
||||||
if (*password != '\0') g_free_and_null(rec->password);
|
if (*password != '\0') g_free_and_null(rec->password);
|
||||||
if (g_hash_table_lookup(optlist, "host")) {
|
if (g_hash_table_lookup(optlist, "host")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user