summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-09 21:26:50 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-09 21:26:50 +0000
commit8938a0f42b178a3bf26ad6976013ad57fb1e5bb2 (patch)
treebb2d5b6588d9db712f89e8d3159d8ece1d943e56 /src/irc
parent6358c2d62727113c15d389dd0e6460ba9a72f941 (diff)
downloadirssi-8938a0f42b178a3bf26ad6976013ad57fb1e5bb2.zip
/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
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-commands.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c
index 2c0f151d..3c32b3ec 100644
--- a/src/irc/core/irc-commands.c
+++ b/src/irc/core/irc-commands.c
@@ -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");