diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-06-12 20:08:22 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-06-12 20:08:22 +0200 |
commit | 98f3924960d849691abc81e0928dc43ad9233b01 (patch) | |
tree | 58bccb259cdbec8cb3aa5677eb8d05799ab55bbb | |
parent | c23d09f65084e6088111dc974f0e290b042de89d (diff) |
Change command name parameter of OnPostCommand to be a Command*
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | src/command_parse.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/postcommand.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 2 |
7 files changed, 10 insertions, 15 deletions
diff --git a/include/modules.h b/include/modules.h index 5055e0b82..a26b6e857 100644 --- a/include/modules.h +++ b/include/modules.h @@ -933,7 +933,7 @@ class CoreExport Module : public classbase, public usecountbase * @param result The return code given by the command handler, one of CMD_SUCCESS or CMD_FAILURE * @param original_line The entire original line as passed to the parser from the user */ - virtual void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, LocalUser *user, CmdResult result, const std::string &original_line); + virtual void OnPostCommand(Command* command, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line); /** Called when a user is first connecting, prior to starting DNS lookups, checking initial * connect class, or accepting any commands. diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 7bedcd71e..e8d68c847 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -339,7 +339,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) */ CmdResult result = handler->Handle(command_p, user); - FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, user, result,cmd)); + FOREACH_MOD(I_OnPostCommand, OnPostCommand(handler, command_p, user, result, cmd)); } } diff --git a/src/modules.cpp b/src/modules.cpp index 75251ffdf..7f3695ade 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -103,7 +103,7 @@ void Module::OnLoadModule(Module*) { } void Module::OnUnloadModule(Module*) { } void Module::OnBackgroundTimer(time_t) { } ModResult Module::OnPreCommand(std::string&, std::vector<std::string>&, LocalUser*, bool, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnPostCommand(const std::string&, const std::vector<std::string>&, LocalUser*, CmdResult, const std::string&) { } +void Module::OnPostCommand(Command*, const std::vector<std::string>&, LocalUser*, CmdResult, const std::string&) { } void Module::OnUserInit(LocalUser*) { } ModResult Module::OnCheckReady(LocalUser*) { return MOD_RES_PASSTHRU; } ModResult Module::OnUserRegister(LocalUser*) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 21e4e156a..9b827a6ef 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -142,7 +142,7 @@ class ModuleSpanningTree : public Module **/ ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, LocalUser *user, bool validated, const std::string &original_line) CXX11_OVERRIDE; - void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, LocalUser *user, CmdResult result, const std::string &original_line) CXX11_OVERRIDE; + void OnPostCommand(Command*, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line) CXX11_OVERRIDE; void OnGetServerDescription(const std::string &servername,std::string &description) CXX11_OVERRIDE; void OnUserConnect(LocalUser* source) CXX11_OVERRIDE; void OnUserInvite(User* source,User* dest,Channel* channel, time_t) CXX11_OVERRIDE; diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 551ce06d5..8ff7ce29a 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -25,20 +25,15 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h */ -void ModuleSpanningTree::OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, LocalUser *user, CmdResult result, const std::string &original_line) +void ModuleSpanningTree::OnPostCommand(Command* command, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line) { if (result == CMD_SUCCESS) Utils->RouteCommand(NULL, command, parameters, user); } -void SpanningTreeUtilities::RouteCommand(TreeServer* origin, const std::string &command, const parameterlist& parameters, User *user) +void SpanningTreeUtilities::RouteCommand(TreeServer* origin, Command* thiscmd, const parameterlist& parameters, User* user) { - if (!ServerInstance->Parser->IsValidCommand(command, parameters.size(), user)) - return; - - /* We know it's non-null because IsValidCommand returned true */ - Command* thiscmd = ServerInstance->Parser->GetHandler(command); - + const std::string& command = thiscmd->name; RouteDescriptor routing = thiscmd->GetRouting(user, parameters); std::string sent_cmd = command; diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 42fb708a9..8b8aafd9e 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -464,7 +464,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, } } who->ForceNickChange(params[0]); - Utils->RouteCommand(route_back_again, command, params, who); + Utils->DoOneToAllButSender(prefix, command, params, prefix); } else { @@ -506,7 +506,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, SendError("Error handling '" + command + "' -- possibly loaded mismatched modules"); } else if (res == CMD_SUCCESS) - Utils->RouteCommand(route_back_again, command, params, who); + Utils->RouteCommand(route_back_again, cmd, params, who); } } diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index e97df3839..1048e1c87 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -124,7 +124,7 @@ class SpanningTreeUtilities : public classbase */ ~SpanningTreeUtilities(); - void RouteCommand(TreeServer*, const std::string&, const parameterlist&, User*); + void RouteCommand(TreeServer*, Command*, const parameterlist&, User*); /** Send a message from this server to one other local or remote */ |