Bug 1718428 - Tidy up existing plugin code in cZ. r=frg
This commit is contained in:
Родитель
a609fad995
Коммит
b1b349b389
|
@ -199,8 +199,7 @@ function cmgr_defcmds(cmdary)
|
||||||
* @param name The |String| name of the command to define.
|
* @param name The |String| name of the command to define.
|
||||||
* @param func A |Function| to call to handle dispatch of the new command.
|
* @param func A |Function| to call to handle dispatch of the new command.
|
||||||
* @param flags Optional. A |Number| indicating any special requirements for the
|
* @param flags Optional. A |Number| indicating any special requirements for the
|
||||||
* command. The |CommandManager| only checks for |CMD_NO_HELP|;
|
* command.
|
||||||
* flags are stored unchanged.
|
|
||||||
* @param usage Optional. A |String| specifying the arguments to the command. If
|
* @param usage Optional. A |String| specifying the arguments to the command. If
|
||||||
* not specified, the property string "cmd." + |name| + ".params"
|
* not specified, the property string "cmd." + |name| + ".params"
|
||||||
* is read from |bundle| or |defaultBundle|.
|
* is read from |bundle| or |defaultBundle|.
|
||||||
|
@ -214,16 +213,13 @@ function cmdmgr_defcmd(name, func, flags, usage, bundle)
|
||||||
if (!bundle)
|
if (!bundle)
|
||||||
bundle = this.defaultBundle;
|
bundle = this.defaultBundle;
|
||||||
|
|
||||||
var helpDefault;
|
var helpDefault = MSG_NO_HELP;
|
||||||
var labelDefault = name;
|
var labelDefault = name;
|
||||||
var aliasFor;
|
var aliasFor;
|
||||||
|
|
||||||
if (typeof flags != "number")
|
if (typeof flags != "number")
|
||||||
flags = this.defaultFlags;
|
flags = this.defaultFlags;
|
||||||
|
|
||||||
if (flags & CMD_NO_HELP)
|
|
||||||
helpDefault = MSG_NO_HELP;
|
|
||||||
|
|
||||||
if (typeof usage != "string")
|
if (typeof usage != "string")
|
||||||
usage = getMsgFrom(bundle, "cmd." + name + ".params", null, "");
|
usage = getMsgFrom(bundle, "cmd." + name + ".params", null, "");
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ const CMD_NEED_NET = 0x02;
|
||||||
const CMD_NEED_SRV = 0x04;
|
const CMD_NEED_SRV = 0x04;
|
||||||
const CMD_NEED_CHAN = 0x08;
|
const CMD_NEED_CHAN = 0x08;
|
||||||
const CMD_NEED_USER = 0x10;
|
const CMD_NEED_USER = 0x10;
|
||||||
const CMD_NO_HELP = 0x20;
|
|
||||||
|
|
||||||
function initCommands()
|
function initCommands()
|
||||||
{
|
{
|
||||||
|
@ -67,11 +66,11 @@ function initCommands()
|
||||||
["default-charset", cmdCharset, CMD_CONSOLE],
|
["default-charset", cmdCharset, CMD_CONSOLE],
|
||||||
["delete-view", cmdDeleteView, CMD_CONSOLE],
|
["delete-view", cmdDeleteView, CMD_CONSOLE],
|
||||||
["desc", cmdDesc, CMD_CONSOLE],
|
["desc", cmdDesc, CMD_CONSOLE],
|
||||||
["disable-plugin", cmdAblePlugin, CMD_CONSOLE],
|
["disable-plugin", cmdDisablePlugin, CMD_CONSOLE],
|
||||||
["disconnect", cmdDisconnect, CMD_NEED_SRV | CMD_CONSOLE],
|
["disconnect", cmdDisconnect, CMD_NEED_SRV | CMD_CONSOLE],
|
||||||
["disconnect-all", cmdDisconnectAll, CMD_CONSOLE],
|
["disconnect-all", cmdDisconnectAll, CMD_CONSOLE],
|
||||||
["echo", cmdEcho, CMD_CONSOLE],
|
["echo", cmdEcho, CMD_CONSOLE],
|
||||||
["enable-plugin", cmdAblePlugin, CMD_CONSOLE],
|
["enable-plugin", cmdEnablePlugin, CMD_CONSOLE],
|
||||||
["eval", cmdEval, CMD_CONSOLE],
|
["eval", cmdEval, CMD_CONSOLE],
|
||||||
["evalsilent", cmdEval, CMD_CONSOLE],
|
["evalsilent", cmdEval, CMD_CONSOLE],
|
||||||
["except", cmdBanOrExcept, CMD_NEED_CHAN | CMD_CONSOLE],
|
["except", cmdBanOrExcept, CMD_NEED_CHAN | CMD_CONSOLE],
|
||||||
|
@ -238,7 +237,7 @@ function initCommands()
|
||||||
cmdary.stringBundle = client.defaultBundle;
|
cmdary.stringBundle = client.defaultBundle;
|
||||||
|
|
||||||
client.commandManager = new CommandManager(client.defaultBundle);
|
client.commandManager = new CommandManager(client.defaultBundle);
|
||||||
client.commandManager.defaultFlags = CMD_NO_HELP | CMD_CONSOLE;
|
client.commandManager.defaultFlags = CMD_CONSOLE;
|
||||||
client.commandManager.isCommandSatisfied = isCommandSatisfied;
|
client.commandManager.isCommandSatisfied = isCommandSatisfied;
|
||||||
client.commandManager.defineCommands(cmdary);
|
client.commandManager.defineCommands(cmdary);
|
||||||
|
|
||||||
|
@ -793,10 +792,8 @@ function getToggle (toggle, currentState)
|
||||||
* command definitions from here on down.
|
* command definitions from here on down.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function cmdAblePlugin(e)
|
function cmdDisablePlugin(e)
|
||||||
{
|
{
|
||||||
if (e.command.name == "disable-plugin")
|
|
||||||
{
|
|
||||||
if (!e.plugin.enabled)
|
if (!e.plugin.enabled)
|
||||||
{
|
{
|
||||||
display(getMsg(MSG_IS_DISABLED, e.plugin.id));
|
display(getMsg(MSG_IS_DISABLED, e.plugin.id));
|
||||||
|
@ -824,9 +821,10 @@ function cmdAblePlugin(e)
|
||||||
|
|
||||||
display(getMsg(MSG_PLUGIN_DISABLED, e.plugin.id));
|
display(getMsg(MSG_PLUGIN_DISABLED, e.plugin.id));
|
||||||
e.plugin.enabled = false;
|
e.plugin.enabled = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
function cmdEnablePlugin(e)
|
||||||
|
{
|
||||||
if (e.plugin.enabled)
|
if (e.plugin.enabled)
|
||||||
{
|
{
|
||||||
display(getMsg(MSG_IS_ENABLED, e.plugin.id));
|
display(getMsg(MSG_IS_ENABLED, e.plugin.id));
|
||||||
|
@ -855,7 +853,6 @@ function cmdAblePlugin(e)
|
||||||
|
|
||||||
display(getMsg(MSG_PLUGIN_ENABLED, e.plugin.id));
|
display(getMsg(MSG_PLUGIN_ENABLED, e.plugin.id));
|
||||||
e.plugin.enabled = true;
|
e.plugin.enabled = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdBanOrExcept(e)
|
function cmdBanOrExcept(e)
|
||||||
|
|
|
@ -3040,6 +3040,7 @@ function cli_installPlugin(name, source)
|
||||||
display(getMsg(MSG_INSTALL_PLUGIN_INSTALLING, [source.path, dest.path]),
|
display(getMsg(MSG_INSTALL_PLUGIN_INSTALLING, [source.path, dest.path]),
|
||||||
MT_INFO);
|
MT_INFO);
|
||||||
|
|
||||||
|
var ary;
|
||||||
if (source.path.match(/\.(jar|zip)$/i))
|
if (source.path.match(/\.(jar|zip)$/i))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Загрузка…
Ссылка в новой задаче