Enhancement - Hooks

- First fully functioning Lua hooks.  Woohoo.
This commit is contained in:
Paul Beckingham 2010-01-18 18:03:31 -05:00
parent eeefc8a992
commit 69cae7731f
6 changed files with 252 additions and 72 deletions

View file

@ -139,8 +139,6 @@ void Context::initialize ()
int Context::run ()
{
int rc;
Timer t ("Context::run");
std::string output;
try
{
@ -193,8 +191,12 @@ int Context::run ()
int Context::dispatch (std::string &out)
{
int rc = 0;
Timer t ("Context::dispatch");
if (! hooks.trigger ("pre-dispatch"))
return rc;
// TODO Just look at this thing. It cries out for a dispatch table.
if (cmd.command == "projects") { rc = handleProjects (out); }
else if (cmd.command == "tags") { rc = handleTags (out); }
@ -245,6 +247,7 @@ int Context::dispatch (std::string &out)
if (cmd.isWriteCommand () && !inShadow)
shadow ();
hooks.trigger ("post-dispatch");
return rc;
}