Added IPv6 and SSL options for command line IRC url

This commit is contained in:
Sebastien Helleu 2005-06-28 08:24:43 +00:00
parent b330ec3dae
commit c69c77507c
8 changed files with 70 additions and 14 deletions

View File

@ -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))

View File

@ -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" \

View File

@ -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;

View File

@ -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

View File

@ -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))

View File

@ -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" \

View File

@ -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;

View File

@ -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