diff options
author | Peter Powell <petpow@saberuk.com> | 2018-07-26 19:43:54 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-07-26 20:12:14 +0100 |
commit | 384ef31bc01e4a1a2e59d082c9066002410ba54a (patch) | |
tree | 06bd81f9e0e48183c1ada07cf7a8757a5028cad1 /src/commands.cpp | |
parent | 09c5439c02f31e9875083e51966dad535af005a9 (diff) |
Use CommandBase::Params instead of std::vector<std::string>.
This is presently a typedef but will soon be replaced with a class
that encapsulates both tags and parameters.
Diffstat (limited to 'src/commands.cpp')
-rw-r--r-- | src/commands.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index c72a5dc73..c5b34c72f 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -23,29 +23,36 @@ #include "inspircd.h" -CmdResult SplitCommand::Handle(const std::vector<std::string>& parms, User* u) +CmdResult SplitCommand::Handle(User* user, const Params& parameters) { - if (IS_LOCAL(u)) - return HandleLocal(parms, IS_LOCAL(u)); - if (IS_REMOTE(u)) - return HandleRemote(parms, IS_REMOTE(u)); - if (IS_SERVER(u)) - return HandleServer(parms, IS_SERVER(u)); - ServerInstance->Logs->Log("COMMAND", LOG_DEFAULT, "Unknown user type in command (uuid=%s)!", u->uuid.c_str()); + switch (user->usertype) + { + case USERTYPE_LOCAL: + return HandleLocal(static_cast<LocalUser*>(user), parameters); + + case USERTYPE_REMOTE: + return HandleRemote(static_cast<RemoteUser*>(user), parameters); + + case USERTYPE_SERVER: + return HandleServer(static_cast<FakeUser*>(user), parameters); + } + + ServerInstance->Logs->Log("COMMAND", LOG_DEFAULT, "Unknown user type %d in command (uuid=%s)!", + user->usertype, user->uuid.c_str()); return CMD_INVALID; } -CmdResult SplitCommand::HandleLocal(const std::vector<std::string>&, LocalUser*) +CmdResult SplitCommand::HandleLocal(LocalUser* user, const Params& parameters) { return CMD_INVALID; } -CmdResult SplitCommand::HandleRemote(const std::vector<std::string>&, RemoteUser*) +CmdResult SplitCommand::HandleRemote(RemoteUser* user, const Params& parameters) { return CMD_INVALID; } -CmdResult SplitCommand::HandleServer(const std::vector<std::string>&, FakeUser*) +CmdResult SplitCommand::HandleServer(FakeUser* user, const Params& parameters) { return CMD_INVALID; } |