mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 07:32:04 +02:00
/CONNECT, /SERVER: added -4 and -6 options for specifying if we should
connect to IPv4 or IPv6 address of the server. If -host or /SET hostname is set irssi determines from it if it should use IPv4 or v6. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1192 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
6358c2d627
commit
8938a0f42b
8 changed files with 39 additions and 22 deletions
|
|
@ -64,7 +64,8 @@ static SERVER_REC *irc_connect_server(const char *data)
|
|||
g_return_val_if_fail(data != NULL, NULL);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 4 | PARAM_FLAG_OPTIONS,
|
||||
"connect", &optlist, &addr, &portstr, &password, &nick))
|
||||
"connect", &optlist, &addr, &portstr,
|
||||
&password, &nick))
|
||||
return NULL;
|
||||
if (*addr == '+') addr++;
|
||||
if (*addr == '\0') {
|
||||
|
|
@ -78,6 +79,11 @@ static SERVER_REC *irc_connect_server(const char *data)
|
|||
|
||||
/* connect to server */
|
||||
conn = server_create_conn(addr, atoi(portstr), password, nick);
|
||||
if (g_hash_table_lookup(optlist, "6") != NULL)
|
||||
conn->family = AF_INET6;
|
||||
else if (g_hash_table_lookup(optlist, "4") != NULL)
|
||||
conn->family = AF_INET;
|
||||
|
||||
ircnet = g_hash_table_lookup(optlist, "ircnet");
|
||||
if (ircnet != NULL && *ircnet != '\0') {
|
||||
g_free_not_null(conn->chatnet);
|
||||
|
|
@ -87,7 +93,7 @@ static SERVER_REC *irc_connect_server(const char *data)
|
|||
if (host != NULL && *host != '\0') {
|
||||
IPADDR ip;
|
||||
|
||||
if (net_gethostbyname(host, &ip) == 0) {
|
||||
if (net_gethostbyname(host, &ip, conn->family) == 0) {
|
||||
if (conn->own_ip == NULL)
|
||||
conn->own_ip = g_new(IPADDR, 1);
|
||||
memcpy(conn->own_ip, &ip, sizeof(IPADDR));
|
||||
|
|
@ -99,7 +105,7 @@ static SERVER_REC *irc_connect_server(const char *data)
|
|||
return server;
|
||||
}
|
||||
|
||||
/* SYNTAX: CONNECT [-ircnet <ircnet>] [-host <hostname>]
|
||||
/* SYNTAX: CONNECT [-4 | -6] [-ircnet <ircnet>] [-host <hostname>]
|
||||
<address>|<ircnet> [<port> [<password> [<nick>]]] */
|
||||
static void cmd_connect(const char *data)
|
||||
{
|
||||
|
|
@ -137,7 +143,7 @@ static RECONNECT_REC *find_reconnect_server(const char *addr, int port)
|
|||
return match;
|
||||
}
|
||||
|
||||
/* SYNTAX: SERVER [-ircnet <ircnet>] [-host <hostname>]
|
||||
/* SYNTAX: SERVER [-4 | -6] [-ircnet <ircnet>] [-host <hostname>]
|
||||
[+]<address>|<ircnet> [<port> [<password> [<nick>]]] */
|
||||
static void cmd_server(const char *data, IRC_SERVER_REC *server,
|
||||
void *item)
|
||||
|
|
@ -1212,7 +1218,7 @@ void irc_commands_init(void)
|
|||
signal_add("whois event", (SIGNAL_FUNC) event_whois);
|
||||
signal_add("whowas event", (SIGNAL_FUNC) event_whowas);
|
||||
|
||||
command_set_options("connect", "+ircnet +host");
|
||||
command_set_options("connect", "4 6 +ircnet +host");
|
||||
command_set_options("topic", "delete");
|
||||
command_set_options("list", "yes");
|
||||
command_set_options("away", "one all");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue