parts.shift();\r
\r
if (parts.length > 0 && parts[0]) {\r
+ // Check to see if we're dealing with an irc: uri, or whether we need to extract the server/channel info from the HTTP URL path.\r
uricheck = parts[0].substr(0, 7).toLowerCase();\r
if ((uricheck === 'ircs%3a') || (uricheck.substr(0,6) === 'irc%3a')) {\r
parts[0] = decodeURIComponent(parts[0]);\r
- console.log(parts[0]);\r
// irc[s]://<host>[:<port>]/[<channel>[?<password>]]\r
uricheck = /^irc(s)?:(?:\/\/?)?([^:\/]+)(?::([0-9]+))?(?:(?:\/)([^\?]*)(?:(?:\?)(.*))?)?$/.exec(parts[0]);\r
- console.log(uricheck);\r
+ /*\r
+ uricheck[1] = ssl (optional)\r
+ uricheck[2] = host\r
+ uricheck[3] = port (optional)\r
+ uricheck[4] = channel (optional)\r
+ uricheck[5] = channel key (optional, channel must also be set)\r
+ */\r
if (uricheck) {\r
- if (uricheck[1]) {\r
+ if (typeof uricheck[1] !== 'undefined') {\r
defaults.ssl = true;\r
if (defaults.port === 6667) {\r
defaults.port = 6697;\r
}\r
}\r
defaults.server = uricheck[2];\r
- if (uricheck[3]) {\r
+ if (typeof uricheck[3] !== 'undefined') {\r
defaults.port = uricheck[3];\r
}\r
- if (uricheck[4]) {\r
+ if (typeof uricheck[4] !== 'undefined') {\r
defaults.channel = '#' + uricheck[4];\r
- if (uricheck[5]) {\r
+ if (typeof uricheck[5] !== 'undefined') {\r
defaults.channel_key = uricheck[5];\r
}\r
}\r
}\r
- console.log(defaults);\r
parts = [];\r
} else {\r
// Extract the port+ssl if we find one\r