bug 223247, unable to connect to irc servers: internal error dispatching

command ���goto-url���
a=asa

js engine new returns empty array element for optional captures in regexps, we need to account for that.
This commit is contained in:
rginda%netscape.com 2003-10-24 18:29:35 +00:00
Родитель 7763797cd2
Коммит 61710761f5
5 изменённых файлов: 30 добавлений и 42 удалений

Просмотреть файл

@ -722,7 +722,7 @@ function parse_int (e, name)
if (!ary)
return false;
e[name] = Number(ary[1]);
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
return true;
}
@ -740,7 +740,7 @@ function parse_word (e, name)
if (!ary)
return false;
e[name] = ary[1];
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
return true;
}
@ -763,7 +763,7 @@ function parse_state (e, name)
e[name] = true;
else
e[name] = false;
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
return true;
}
@ -790,7 +790,7 @@ function parse_toggle (e, name)
e[name] = true;
else
e[name] = false;
e.unparsedData = (2 in ary) ? ary[2] : "";
e.unparsedData = arrayHasElementAt(ary, 2) ? ary[2] : "";
return true;
}

Просмотреть файл

@ -409,11 +409,20 @@ function serv_login(nick, name, desc)
nick = nick.replace(" ", "_");
name = name.replace(" ", "_");
if (!nick)
nick = "nick";
if (!name)
name = nick;
if (!desc)
desc = nick;
this.me = new CIRCUser(this, nick, name);
if (this.password)
this.sendData("PASS " + this.password + "\n");
this.sendData("NICK " + nick + "\n");
this.sendData("USER " + name + " foo bar :" +
this.sendData("USER " + name + " * * :" +
fromUnicode(desc, this) + "\n");
}

Просмотреть файл

@ -599,6 +599,11 @@ function formatDateOffset (offset, format)
return format;
}
function arrayHasElementAt(ary, i)
{
return typeof ary[i] != "undefined";
}
function arrayContains (ary, elem)
{
return (arrayIndexOf (ary, elem) != -1);
@ -615,38 +620,12 @@ function arrayIndexOf (ary, elem)
function arrayInsertAt (ary, i, o)
{
ary.splice (i, 0, o);
/* doh, forgot about that 'splice' thing
if (ary.length < i)
{
this[i] = o;
return;
}
for (var j = ary.length; j > i; j--)
ary[j] = ary[j - 1];
ary[i] = o;
*/
}
function arrayRemoveAt (ary, i)
{
ary.splice (i, 1);
/* doh, forgot about that 'splice' thing
if (ary.length < i)
return false;
for (var j = i; j < ary.length; j++)
ary[j] = ary[j + 1];
ary.length--;
*/
}
/* length should be an even number >= 6 */

Просмотреть файл

@ -472,7 +472,7 @@ function parsePlugin(e, name)
}
e.unparsedData = (4 in ary) ? ary[4] : "";
e.unparsedData = arrayHasElementAt(ary, 4) ? ary[4] : "";
e[name] = plugin;
return true;
}
@ -809,7 +809,7 @@ function cmdHelp (e)
}
for (var i in ary)
{
{
display (getMsg(MSG_FMT_USAGE, [ary[i].name, ary[i].usage]), MT_USAGE);
display (ary[i].help, MT_HELP);
}

Просмотреть файл

@ -34,7 +34,7 @@
* Samuel Sieb, samuel@sieb.net, MIRC color codes, munger menu, and various
*/
const __cz_version = "0.9.44";
const __cz_version = "0.9.45";
const __cz_condition = "green";
var warn;
@ -1168,7 +1168,7 @@ function parseIRCURL (url)
return null;
}
var host = ary[1];
var rest = (2 in ary) ? ary[2] : "";
var rest = arrayHasElementAt(ary, 2) ? ary[2] : "";
/* split <host> into server (or network) / port */
ary = host.match (/^([^\s\:]+)?(\:\d+)?$/);
@ -1178,9 +1178,9 @@ function parseIRCURL (url)
return null;
}
if (2 in ary)
if (arrayHasElementAt(ary, 2))
{
if (!(1 in ary))
if (!arrayHasElementAt(ary, 2))
{
dd ("parseIRCURL: port with no host");
return null;
@ -1189,7 +1189,7 @@ function parseIRCURL (url)
rv.isserver = true;
rv.port = parseInt(ary[2].substr(1));
}
else if (1 in ary)
else if (arrayHasElementAt(ary, 1))
{
specifiedHost = rv.host = ary[1].toLowerCase();
if (specifiedHost.indexOf(".") != -1)
@ -1205,13 +1205,13 @@ function parseIRCURL (url)
return null;
}
rv.target = (1 in ary) ?
unescape(ary[1]).replace("\n", "\\n") : "";
rv.target = arrayHasElementAt(ary, 1) ?
ecmaUnescape(ary[1]).replace("\n", "\\n") : "";
var i = rv.target.indexOf(" ");
if (i != -1)
rv.target = rv.target.substr(0, i);
var params = (2 in ary) ? ary[2].toLowerCase() : "";
var query = (3 in ary) ? ary[3] : "";
var params = arrayHasElementAt(ary, 2) ? ary[2].toLowerCase() : "";
var query = arrayHasElementAt(ary, 3) ? ary[3] : "";
if (params)
{