diff options
author | Peter Powell <petpow@saberuk.com> | 2018-08-09 20:44:43 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-08-10 13:55:32 +0100 |
commit | 213e4d9680e427bc16b94c0c1b627919cacb171b (patch) | |
tree | 16f4f36d2c7e7e227af5c10a2d1b054bb7488f6e /src/modules | |
parent | 626003a7dcbb00d4344e3554a2e265792dbcc952 (diff) |
Remove the original line parameter of On{Pre,Post}Command.
In the brave new world of message tags and alternate wire formats
this is no longer something that is appropriate to expose.
In reality it was only ever used by m_alias which now reconstitutes
the command name and parameters into a RFC 1459-style message for
whatever it needs to do.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_abbreviation.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_alias.cpp | 17 | ||||
-rw-r--r-- | src/modules/m_blockamsg.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_waitpong.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_ldapoper.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_maphide.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_namesx.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operlog.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_securelist.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_shun.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/postcommand.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/precommand.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sqloper.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sslinfo.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_uhnames.cpp | 2 |
17 files changed, 35 insertions, 20 deletions
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 22baa916b..f5065c73f 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -38,7 +38,7 @@ class ModuleAbbreviation : public Module return Version("Provides the ability to abbreviate commands a-la BBC BASIC keywords.",VF_VENDOR); } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { /* Command is already validated, has a length of 0, or last character is not a . */ if (validated || command.empty() || *command.rbegin() != '.') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index a8e39cb47..433397123 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -129,7 +129,21 @@ class ModuleAlias : public Module return word; } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + std::string CreateRFCMessage(const std::string& command, Command::Params& parameters) + { + std::string message(command); + for (CommandBase::Params::const_iterator iter = parameters.begin(); iter != parameters.end();) + { + const std::string& parameter = *++iter; + message.push_back(' '); + if (iter == parameters.end()) + message.push_back(':'); + message.append(parameter); + } + return message; + } + + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { /* If theyre not registered yet, we dont want * to know. @@ -143,6 +157,7 @@ class ModuleAlias : public Module return MOD_RES_PASSTHRU; /* The parameters for the command in their original form, with the command stripped off */ + std::string original_line = CreateRFCMessage(command, parameters); std::string compare(original_line, command.length()); while (*(compare.c_str()) == ' ') compare.erase(compare.begin()); diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 3c8fcd1b5..c4af2fd7f 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -81,7 +81,7 @@ class ModuleBlockAmsg : public Module action = IBLOCK_KILLOPERS; } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { // Don't do anything with unregistered users if (user->registered != REG_ALL) diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index f9e9262a7..b4441c88c 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -56,7 +56,7 @@ class ModuleWaitPong : public Module return MOD_RES_PASSTHRU; } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if (command == "PONG") { diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 343a62a8d..c039c0455 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -196,7 +196,7 @@ class ModuleFilter : public Module, public ServerEventListener, public Stats::Ev void OnSyncNetwork(ProtocolInterface::Server& server) CXX11_OVERRIDE; void OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata) CXX11_OVERRIDE; ModResult OnStats(Stats::Context& stats) CXX11_OVERRIDE; - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE; + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE; void OnUnloadModule(Module* mod) CXX11_OVERRIDE; bool AppliesToMe(User* user, FilterResult* filter, int flags); void ReadFilters(); @@ -413,7 +413,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar return MOD_RES_PASSTHRU; } -ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) +ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) { if (validated) { diff --git a/src/modules/m_ldapoper.cpp b/src/modules/m_ldapoper.cpp index 104c3bb21..094b37744 100644 --- a/src/modules/m_ldapoper.cpp +++ b/src/modules/m_ldapoper.cpp @@ -201,7 +201,7 @@ class ModuleLDAPAuth : public Module attribute = tag->getString("attribute"); } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if (validated && command == "OPER" && parameters.size() >= 2) { diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index 7c5f6b97b..7a1ee39e1 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -28,7 +28,7 @@ class ModuleMapHide : public Module url = ServerInstance->Config->ConfValue("security")->getString("maphide"); } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if (validated && !user->IsOper() && !url.empty() && (command == "MAP" || command == "LINKS")) { diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 98fac8872..708b98e56 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -41,7 +41,7 @@ class ModuleNamesX : public Module tokens["NAMESX"]; } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { /* We don't actually create a proper command handler class for PROTOCTL, * because other modules might want to have PROTOCTL hooks too. diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 53bc247be..b64e18870 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -41,7 +41,7 @@ class ModuleOperLog : public Module tosnomask = ServerInstance->Config->ConfValue("operlog")->getBool("tosnomask", false); } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index b1aeeb9d4..aa14707b1 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -52,7 +52,7 @@ class ModuleSecureList : public Module * OnPreCommand() * Intercept the LIST command. */ - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 267e15ad7..da090e4f8 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -198,7 +198,7 @@ class ModuleShun : public Module, public Stats::EventListener affectopers = tag->getBool("affectopers", false); } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if (validated) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 4479b0700..34b657720 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -142,8 +142,8 @@ class ModuleSpanningTree : public Module, public Stats::EventListener ** *** MODULE EVENTS *** **/ - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE; - void OnPostCommand(Command*, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, const std::string& original_line) CXX11_OVERRIDE; + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE; + void OnPostCommand(Command*, const CommandBase::Params& parameters, LocalUser* user, CmdResult result) CXX11_OVERRIDE; void OnUserConnect(LocalUser* source) CXX11_OVERRIDE; void OnUserInvite(User* source, User* dest, Channel* channel, time_t timeout, unsigned int notifyrank, CUList& notifyexcepts) CXX11_OVERRIDE; ModResult OnPreTopicChange(User* user, Channel* chan, const std::string& topic) CXX11_OVERRIDE; diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index b50b5e852..c6bc04fc2 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -24,7 +24,7 @@ #include "treeserver.h" #include "commandbuilder.h" -void ModuleSpanningTree::OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, const std::string& original_line) +void ModuleSpanningTree::OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result) { if (result == CMD_SUCCESS) Utils->RouteCommand(NULL, command, parameters, user); diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index 0d5268493..5db8aafe3 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -22,7 +22,7 @@ #include "main.h" -ModResult ModuleSpanningTree::OnPreCommand(std::string &command, CommandBase::Params& parameters, LocalUser *user, bool validated, const std::string &original_line) +ModResult ModuleSpanningTree::OnPreCommand(std::string &command, CommandBase::Params& parameters, LocalUser *user, bool validated) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index e126e584e..2b298f662 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -138,7 +138,7 @@ class OperQuery : public SQL::Query ModResult MOD_RESULT; std::string origin = "OPER"; - FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (origin, params, localuser, true, origin)); + FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (origin, params, localuser, true)); if (MOD_RESULT == MOD_RES_DENY) return; @@ -195,7 +195,7 @@ public: } } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { // If we are not in the middle of an existing /OPER and someone is trying to oper-up if (validated && command == "OPER" && parameters.size() >= 2 && !active) diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 7b73740db..6f679a871 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -179,7 +179,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener } } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if ((command == "OPER") && (validated)) { diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index 4165519fc..a8814b343 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -41,7 +41,7 @@ class ModuleUHNames : public Module tokens["UHNAMES"]; } - ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { /* We don't actually create a proper command handler class for PROTOCTL, * because other modules might want to have PROTOCTL hooks too. |