From: Jack Allnutt Date: Sat, 3 Nov 2012 20:42:25 +0000 (+0000) Subject: Removing debugging, adding some comments X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4f8da37d10b3c5c9762d9a6285376a73ad58b392;p=KiwiIRC.git Removing debugging, adding some comments --- diff --git a/client/assets/dev/model_application.js b/client/assets/dev/model_application.js index b3d11c7..e11bb95 100644 --- a/client/assets/dev/model_application.js +++ b/client/assets/dev/model_application.js @@ -152,32 +152,37 @@ kiwi.model.Application = function () { parts.shift(); if (parts.length > 0 && parts[0]) { + // 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. uricheck = parts[0].substr(0, 7).toLowerCase(); if ((uricheck === 'ircs%3a') || (uricheck.substr(0,6) === 'irc%3a')) { parts[0] = decodeURIComponent(parts[0]); - console.log(parts[0]); // irc[s]://[:]/[[?]] uricheck = /^irc(s)?:(?:\/\/?)?([^:\/]+)(?::([0-9]+))?(?:(?:\/)([^\?]*)(?:(?:\?)(.*))?)?$/.exec(parts[0]); - console.log(uricheck); + /* + uricheck[1] = ssl (optional) + uricheck[2] = host + uricheck[3] = port (optional) + uricheck[4] = channel (optional) + uricheck[5] = channel key (optional, channel must also be set) + */ if (uricheck) { - if (uricheck[1]) { + if (typeof uricheck[1] !== 'undefined') { defaults.ssl = true; if (defaults.port === 6667) { defaults.port = 6697; } } defaults.server = uricheck[2]; - if (uricheck[3]) { + if (typeof uricheck[3] !== 'undefined') { defaults.port = uricheck[3]; } - if (uricheck[4]) { + if (typeof uricheck[4] !== 'undefined') { defaults.channel = '#' + uricheck[4]; - if (uricheck[5]) { + if (typeof uricheck[5] !== 'undefined') { defaults.channel_key = uricheck[5]; } } } - console.log(defaults); parts = []; } else { // Extract the port+ssl if we find one