diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-06-12 20:51:16 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-06-12 20:51:16 +0200 |
commit | 97449ad5695dd63841c9e8426e75f3c6543c16da (patch) | |
tree | 3e6bd32d41876be9c13958982e3624dd7f973c43 /src/command_parse.cpp | |
parent | cfa32a6561e0152ebbd7135eaec9f7c794c170b1 (diff) |
Run the OnPostCommand hook from LoopCall()
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r-- | src/command_parse.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 6331b5da4..35cb1601b 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -44,7 +44,7 @@ int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::st return (data != input); // this seems back to front, but returns 0 if they *match*, 1 else } -bool CommandParser::LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere, int extra, bool usemax) +bool CommandParser::LoopCall(User* user, Command* handler, const std::vector<std::string>& parameters, unsigned int splithere, int extra, bool usemax) { if (splithere >= parameters.size()) return false; @@ -73,6 +73,7 @@ bool CommandParser::LoopCall(User* user, Command* CommandObj, const std::vector< irc::commasepstream items2(extra >= 0 ? parameters[extra] : "", true); std::string item; unsigned int max = 0; + LocalUser* localuser = IS_LOCAL(user); /* Attempt to iterate these lists and call the command handler * for every parameter or parameter pair until there are no more @@ -93,7 +94,14 @@ bool CommandParser::LoopCall(User* user, Command* CommandObj, const std::vector< new_parameters[extra] = item; } - CommandObj->Handle(new_parameters, user); + CmdResult result = handler->Handle(new_parameters, user); + if (localuser) + { + // Run the OnPostCommand hook with the last parameter (original line) being empty + // to indicate that the command had more targets in its original form. + item.clear(); + FOREACH_MOD(I_OnPostCommand, OnPostCommand(handler, new_parameters, localuser, result, item)); + } } } |