Bug 1718428 - Tidy up existing plugin code in cZ. r=frg

This commit is contained in:
Ian Neal 2021-06-27 03:30:17 +01:00
Родитель a609fad995
Коммит b1b349b389
3 изменённых файлов: 51 добавлений и 57 удалений

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

@ -199,8 +199,7 @@ function cmgr_defcmds(cmdary)
* @param name The |String| name of the command to define.
* @param func A |Function| to call to handle dispatch of the new command.
* @param flags Optional. A |Number| indicating any special requirements for the
* command. The |CommandManager| only checks for |CMD_NO_HELP|;
* flags are stored unchanged.
* command.
* @param usage Optional. A |String| specifying the arguments to the command. If
* not specified, the property string "cmd." + |name| + ".params"
* is read from |bundle| or |defaultBundle|.
@ -214,16 +213,13 @@ function cmdmgr_defcmd(name, func, flags, usage, bundle)
if (!bundle)
bundle = this.defaultBundle;
var helpDefault;
var helpDefault = MSG_NO_HELP;
var labelDefault = name;
var aliasFor;
if (typeof flags != "number")
flags = this.defaultFlags;
if (flags & CMD_NO_HELP)
helpDefault = MSG_NO_HELP;
if (typeof usage != "string")
usage = getMsgFrom(bundle, "cmd." + name + ".params", null, "");

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

@ -9,7 +9,6 @@ const CMD_NEED_NET = 0x02;
const CMD_NEED_SRV = 0x04;
const CMD_NEED_CHAN = 0x08;
const CMD_NEED_USER = 0x10;
const CMD_NO_HELP = 0x20;
function initCommands()
{
@ -67,11 +66,11 @@ function initCommands()
["default-charset", cmdCharset, CMD_CONSOLE],
["delete-view", cmdDeleteView, CMD_CONSOLE],
["desc", cmdDesc, CMD_CONSOLE],
["disable-plugin", cmdAblePlugin, CMD_CONSOLE],
["disable-plugin", cmdDisablePlugin, CMD_CONSOLE],
["disconnect", cmdDisconnect, CMD_NEED_SRV | CMD_CONSOLE],
["disconnect-all", cmdDisconnectAll, CMD_CONSOLE],
["echo", cmdEcho, CMD_CONSOLE],
["enable-plugin", cmdAblePlugin, CMD_CONSOLE],
["enable-plugin", cmdEnablePlugin, CMD_CONSOLE],
["eval", cmdEval, CMD_CONSOLE],
["evalsilent", cmdEval, CMD_CONSOLE],
["except", cmdBanOrExcept, CMD_NEED_CHAN | CMD_CONSOLE],
@ -238,7 +237,7 @@ function initCommands()
cmdary.stringBundle = 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.defineCommands(cmdary);
@ -793,10 +792,8 @@ function getToggle (toggle, currentState)
* command definitions from here on down.
*/
function cmdAblePlugin(e)
function cmdDisablePlugin(e)
{
if (e.command.name == "disable-plugin")
{
if (!e.plugin.enabled)
{
display(getMsg(MSG_IS_DISABLED, e.plugin.id));
@ -824,9 +821,10 @@ function cmdAblePlugin(e)
display(getMsg(MSG_PLUGIN_DISABLED, e.plugin.id));
e.plugin.enabled = false;
}
else
{
}
function cmdEnablePlugin(e)
{
if (e.plugin.enabled)
{
display(getMsg(MSG_IS_ENABLED, e.plugin.id));
@ -855,7 +853,6 @@ function cmdAblePlugin(e)
display(getMsg(MSG_PLUGIN_ENABLED, e.plugin.id));
e.plugin.enabled = true;
}
}
function cmdBanOrExcept(e)

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

@ -3040,6 +3040,7 @@ function cli_installPlugin(name, source)
display(getMsg(MSG_INSTALL_PLUGIN_INSTALLING, [source.path, dest.path]),
MT_INFO);
var ary;
if (source.path.match(/\.(jar|zip)$/i))
{
try