From 911241a85cea69a04948c0db2d6ef7573ed65df2 Mon Sep 17 00:00:00 2001 From: "silver%warwickcompsoc.co.uk" Date: Sat, 18 Mar 2006 15:20:32 +0000 Subject: [PATCH] Bug 329702 - Allow code to hook all commands as well as individual ones. ChatZilla only. r=samuel --- extensions/irc/xul/content/commands.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/irc/xul/content/commands.js b/extensions/irc/xul/content/commands.js index 447677756d15..e56d18268031 100644 --- a/extensions/irc/xul/content/commands.js +++ b/extensions/irc/xul/content/commands.js @@ -647,8 +647,10 @@ function dispatchCommand (command, e, flags) } else { + if ("beforeHooks" in client.commandManager) + callHooks(client.commandManager, true); if ("beforeHooks" in e.command) - callHooks (e.command, true); + callHooks(e.command, true); if ("dbgDispatch" in client && client.dbgDispatch) { @@ -677,8 +679,10 @@ function dispatchCommand (command, e, flags) else if (typeof e.command.func == "string") { /* dispatch an alias (semicolon delimited list of subcommands) */ + if ("beforeHooks" in client.commandManager) + callHooks(client.commandManager, true); if ("beforeHooks" in e.command) - callHooks (e.command, true); + callHooks(e.command, true); var commandList; //Don't make use of e.inputData if we have multiple commands in 1 alias @@ -722,7 +726,9 @@ function dispatchCommand (command, e, flags) } if ("afterHooks" in e.command) - callHooks (e.command, false); + callHooks(e.command, false); + if ("afterHooks" in client.commandManager) + callHooks(client.commandManager, false); return ("returnValue" in e) ? e.returnValue : null; }