Mozilla/mozilla/extensions/irc/js/lib/command-manager.js
rginda%netscape.com a52ad6116a --CHATZILLA CHANGES ONLY--
a=brendan

* chatzilla-service.js
added components required for irc:// urls.

* command-manager.js
sort names before returning

* connection-xpcom.js
added support for async reads.

* events.js
Added "yield" event type to break out of event processing.

* irc-debug.js
add MPL
show data for "senddata" type events.

* irc.js
add password param for server.login() method.
add key param for channel.join() method.
refactoring to use the connection's async read method if it's there
(it's not in connection-rhino.js yet.)

* utils.js
add hyphenateWord function.

* chatzilla.xul
add windowtype attribute.
apply exv@randomc.com 's userlist context menu patch.

* commands.js
apply cbegle@geocast.com 's /stalk and /unstalk patch.
update join, server, and attach commands to include new params.
alias leave part.
removed bogus comments.

* handlers.js
apply cbegle@geocast.com 's /stalk and /unstalk patch.
update join, server, and attach commands to include new params.
check for pending irc urls after connection is made.

* static.js
apply cbegle@geocast.com 's /stalk and /unstalk patch.
apply exv@randomc.com 's userlist context menu patch.
add long word rule to munger.
implement parseIRCURL() and gotoIRCURL() function.
implement doURLTest() to test the other two.


git-svn-id: svn://10.0.0.236/trunk@71248 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-01 05:31:04 +00:00

90 lines
2.3 KiB
JavaScript

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is JSIRC Library
*
* The Initial Developer of the Original Code is New Dimensions Consulting,
* Inc. Portions created by New Dimensions Consulting, Inc. are
* Copyright (C) 1999 New Dimenstions Consulting, Inc. All
* Rights Reserved.
*
* Contributor(s):
*
*
* Contributor(s):
* Robert Ginda, rginda@ndcico.com, original author
*/
function CCommandManager ()
{
this.commands = new Array();
}
CCommandManager.prototype.add =
function cmgr_add (name, func, usage, help)
{
function compare (a, b)
{
if (a.name == b.name)
return 0;
else
if (a.name > b.name)
return 1;
else
return -1;
}
this.commands.push ({name: name, func: func, usage: usage, help: help});
this.commands = this.commands.sort(compare);
}
CCommandManager.prototype.list =
function cmgr_list (partialName)
{
/* returns array of command objects which look like |partialName|, or
* all commands if |partialName| is not specified */
if ((typeof partialName == "undefined") ||
(String(partialName) == ""))
return this.commands;
var ary = new Array();
for (var i in this.commands)
{
if (this.commands[i].name.indexOf(partialName) == 0)
if (partialName.length == this.commands[i].name.length)
/* exact match */
return [this.commands[i]];
else
ary.push (this.commands[i]);
}
return ary;
}
CCommandManager.prototype.listNames =
function cmgr_listnames (partialName)
{
var cmds = this.list(partialName);
var cmdNames = new Array();
for (var c in cmds)
cmdNames.push (cmds[c].name);
return cmdNames.sort();
}