diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-06-28 08:24:43 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-06-28 08:24:43 +0000 |
commit | c69c77507c7a373c4d1b31692ea5506d26e46bc0 (patch) | |
tree | 6b55a5a6dbd5c9575dedea4eaa6a836cc97a3dac | |
parent | b330ec3dae2db59089ce44ec7c1ab7f0473e8ee6 (diff) | |
download | weechat-c69c77507c7a373c4d1b31692ea5506d26e46bc0.zip |
Added IPv6 and SSL options for command line IRC url
-rw-r--r-- | src/common/weechat.c | 5 | ||||
-rw-r--r-- | src/common/weechat.h | 2 | ||||
-rw-r--r-- | src/irc/irc-server.c | 31 | ||||
-rw-r--r-- | weechat-curses.1 | 4 | ||||
-rw-r--r-- | weechat/src/common/weechat.c | 5 | ||||
-rw-r--r-- | weechat/src/common/weechat.h | 2 | ||||
-rw-r--r-- | weechat/src/irc/irc-server.c | 31 | ||||
-rw-r--r-- | weechat/weechat-curses.1 | 4 |
8 files changed, 70 insertions, 14 deletions
diff --git a/src/common/weechat.c b/src/common/weechat.c index 28549a0d7..1a8db3385 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -364,7 +364,7 @@ wee_parse_args (int argc, char *argv[]) wee_display_commands (1, 0); wee_shutdown (EXIT_SUCCESS); } - else if ((strncasecmp (argv[i], "irc://", 6) == 0)) + else if ((strncasecmp (argv[i], "irc", 3) == 0)) { if (server_init_with_url (argv[i], &server_tmp) < 0) { @@ -376,7 +376,8 @@ wee_parse_args (int argc, char *argv[]) if (!server_new (server_tmp.name, server_tmp.autoconnect, server_tmp.autoreconnect, server_tmp.autoreconnect_delay, - 1, server_tmp.address, server_tmp.port, 0, 0, + 1, server_tmp.address, server_tmp.port, + server_tmp.ipv6, server_tmp.ssl, server_tmp.password, server_tmp.nick1, server_tmp.nick2, server_tmp.nick3, NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL)) diff --git a/src/common/weechat.h b/src/common/weechat.h index 33160a52f..ead962144 100644 --- a/src/common/weechat.h +++ b/src/common/weechat.h @@ -86,7 +86,7 @@ PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \ "\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \ "Usage: %s [options ...]\n" \ - " or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n" + " or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n" #define WEE_USAGE2 \ " -c, --config display config file options\n" \ diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c index 5ac4e314e..3c24e00cc 100644 --- a/src/irc/irc-server.c +++ b/src/irc/irc-server.c @@ -120,18 +120,42 @@ int server_init_with_url (char *irc_url, t_irc_server *server) { char *url, *pos_server, *pos_channel, *pos, *pos2; + int ipv6, ssl; struct passwd *my_passwd; server_init (server); - if (strncasecmp (irc_url, "irc://", 6) != 0) + ipv6 = 0; + ssl = 0; + if (strncasecmp (irc_url, "irc6://", 7) == 0) + { + pos = irc_url + 7; + ipv6 = 1; + } + else if (strncasecmp (irc_url, "ircs://", 7) == 0) + { + pos = irc_url + 7; + ssl = 1; + } + else if ((strncasecmp (irc_url, "irc6s://", 8) == 0) + || (strncasecmp (irc_url, "ircs6://", 8) == 0)) + { + pos = irc_url + 8; + ipv6 = 1; + ssl = 1; + } + else if (strncasecmp (irc_url, "irc://", 6) == 0) + { + pos = irc_url + 6; + } + else return -1; + url = strdup (irc_url); pos_server = strchr (url, '@'); if (pos_server) { pos_server[0] = '\0'; pos_server++; - pos = url + 6; if (!pos[0]) { free (url); @@ -193,6 +217,9 @@ server_init_with_url (char *irc_url, t_irc_server *server) free (url); + server->ipv6 = ipv6; + server->ssl = ssl; + /* some default values */ if (server->port < 0) server->port = DEFAULT_IRC_PORT; diff --git a/weechat-curses.1 b/weechat-curses.1 index 51eb4e9f4..11f5c367f 100644 --- a/weechat-curses.1 +++ b/weechat-curses.1 @@ -1,4 +1,4 @@ -.TH WEECHAT 1 "May 2005" "FlashCode" +.TH WEECHAT 1 "June 2005" "FlashCode" .SH NAME weechat-curses \- Wee Enhanced Environment for Chat (Curses version) @@ -39,7 +39,7 @@ display WeeChat version WeeChat can use an URL (Uniform Resource Locator) to automatically connect to an IRC server. These are in the following form: .TP -.B irc://[[nickname][:password]@]server[:port][/[#&+!]channel] +.B irc[6][s]://[[nickname][:password]@]server[:port][/[#&+!]channel[,channel...]] .TP Exemple to join WeeChat channel support with nick "FlashCode": irc://FlashCode@irc.freenode.net/weechat diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index 28549a0d7..1a8db3385 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -364,7 +364,7 @@ wee_parse_args (int argc, char *argv[]) wee_display_commands (1, 0); wee_shutdown (EXIT_SUCCESS); } - else if ((strncasecmp (argv[i], "irc://", 6) == 0)) + else if ((strncasecmp (argv[i], "irc", 3) == 0)) { if (server_init_with_url (argv[i], &server_tmp) < 0) { @@ -376,7 +376,8 @@ wee_parse_args (int argc, char *argv[]) if (!server_new (server_tmp.name, server_tmp.autoconnect, server_tmp.autoreconnect, server_tmp.autoreconnect_delay, - 1, server_tmp.address, server_tmp.port, 0, 0, + 1, server_tmp.address, server_tmp.port, + server_tmp.ipv6, server_tmp.ssl, server_tmp.password, server_tmp.nick1, server_tmp.nick2, server_tmp.nick3, NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL)) diff --git a/weechat/src/common/weechat.h b/weechat/src/common/weechat.h index 33160a52f..ead962144 100644 --- a/weechat/src/common/weechat.h +++ b/weechat/src/common/weechat.h @@ -86,7 +86,7 @@ PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \ "\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \ "Usage: %s [options ...]\n" \ - " or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n" + " or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n" #define WEE_USAGE2 \ " -c, --config display config file options\n" \ diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c index 5ac4e314e..3c24e00cc 100644 --- a/weechat/src/irc/irc-server.c +++ b/weechat/src/irc/irc-server.c @@ -120,18 +120,42 @@ int server_init_with_url (char *irc_url, t_irc_server *server) { char *url, *pos_server, *pos_channel, *pos, *pos2; + int ipv6, ssl; struct passwd *my_passwd; server_init (server); - if (strncasecmp (irc_url, "irc://", 6) != 0) + ipv6 = 0; + ssl = 0; + if (strncasecmp (irc_url, "irc6://", 7) == 0) + { + pos = irc_url + 7; + ipv6 = 1; + } + else if (strncasecmp (irc_url, "ircs://", 7) == 0) + { + pos = irc_url + 7; + ssl = 1; + } + else if ((strncasecmp (irc_url, "irc6s://", 8) == 0) + || (strncasecmp (irc_url, "ircs6://", 8) == 0)) + { + pos = irc_url + 8; + ipv6 = 1; + ssl = 1; + } + else if (strncasecmp (irc_url, "irc://", 6) == 0) + { + pos = irc_url + 6; + } + else return -1; + url = strdup (irc_url); pos_server = strchr (url, '@'); if (pos_server) { pos_server[0] = '\0'; pos_server++; - pos = url + 6; if (!pos[0]) { free (url); @@ -193,6 +217,9 @@ server_init_with_url (char *irc_url, t_irc_server *server) free (url); + server->ipv6 = ipv6; + server->ssl = ssl; + /* some default values */ if (server->port < 0) server->port = DEFAULT_IRC_PORT; diff --git a/weechat/weechat-curses.1 b/weechat/weechat-curses.1 index 51eb4e9f4..11f5c367f 100644 --- a/weechat/weechat-curses.1 +++ b/weechat/weechat-curses.1 @@ -1,4 +1,4 @@ -.TH WEECHAT 1 "May 2005" "FlashCode" +.TH WEECHAT 1 "June 2005" "FlashCode" .SH NAME weechat-curses \- Wee Enhanced Environment for Chat (Curses version) @@ -39,7 +39,7 @@ display WeeChat version WeeChat can use an URL (Uniform Resource Locator) to automatically connect to an IRC server. These are in the following form: .TP -.B irc://[[nickname][:password]@]server[:port][/[#&+!]channel] +.B irc[6][s]://[[nickname][:password]@]server[:port][/[#&+!]channel[,channel...]] .TP Exemple to join WeeChat channel support with nick "FlashCode": irc://FlashCode@irc.freenode.net/weechat |