summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-07-26 19:43:54 +0100
committerPeter Powell <petpow@saberuk.com>2018-07-26 20:12:14 +0100
commit384ef31bc01e4a1a2e59d082c9066002410ba54a (patch)
tree06bd81f9e0e48183c1ada07cf7a8757a5028cad1 /include
parent09c5439c02f31e9875083e51966dad535af005a9 (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 'include')
-rw-r--r--include/command_parse.h6
-rw-r--r--include/commands/cmd_whowas.h2
-rw-r--r--include/ctables.h14
-rw-r--r--include/inspircd.h2
-rw-r--r--include/modules.h4
-rw-r--r--include/modules/sasl.h2
-rw-r--r--include/numeric.h6
-rw-r--r--include/protocol.h6
8 files changed, 21 insertions, 21 deletions
diff --git a/include/command_parse.h b/include/command_parse.h
index ec5ebba48..8324e5e25 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -65,7 +65,7 @@ class CoreExport CommandParser
* command simply did not exist at all or the wrong number of parameters were given, or the user
* was not privilaged enough to execute the command.
*/
- CmdResult CallHandler(const std::string& commandname, const std::vector<std::string>& parameters, User* user, Command** cmd = NULL);
+ CmdResult CallHandler(const std::string& commandname, const CommandBase::Params& parameters, User* user, Command** cmd = NULL);
/** Get the handler function for a command.
* @param commandname The command required. Always use uppercase for this parameter.
@@ -110,7 +110,7 @@ class CoreExport CommandParser
* command handler for each entry on the list. When this occurs, the caller should return without doing anything,
* otherwise it should continue into its main section of code.
*/
- static bool LoopCall(User* user, Command* handler, const std::vector<std::string>& parameters, unsigned int splithere, int extra = -1, bool usemax = true);
+ static bool LoopCall(User* user, Command* handler, const CommandBase::Params& parameters, unsigned int splithere, int extra = -1, bool usemax = true);
/** Take a raw input buffer from a recvq, and process it on behalf of a user.
* @param buffer The buffer line to process
@@ -144,7 +144,7 @@ class CoreExport CommandParser
* @param custom_translator Used to translate the parameter if the translation type is TR_CUSTOM, if NULL, TR_CUSTOM will act like TR_TEXT
* @return dest The output string
*/
- static std::string TranslateUIDs(const std::vector<TranslateType>& to, const std::vector<std::string>& source, bool prefix_final = false, CommandBase* custom_translator = NULL);
+ static std::string TranslateUIDs(const std::vector<TranslateType>& to, const CommandBase::Params& source, bool prefix_final = false, CommandBase* custom_translator = NULL);
};
/** A lookup table of values for multiplier characters used by
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index 03ffae905..6af0c7c55 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -203,5 +203,5 @@ class CommandWhowas : public Command
* @param user The user issuing the command
* @return A value from CmdResult to indicate command success or failure.
*/
- CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE;
+ CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
};
diff --git a/include/ctables.h b/include/ctables.h
index 43a311a66..c34e4abeb 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -110,6 +110,8 @@ struct RouteDescriptor
class CoreExport CommandBase : public ServiceProvider
{
public:
+ typedef std::vector<std::string> Params;
+
/** User flags needed to execute the command or 0
*/
unsigned char flags_needed;
@@ -168,7 +170,7 @@ class CoreExport CommandBase : public ServiceProvider
*/
CommandBase(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0);
- virtual RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
+ virtual RouteDescriptor GetRouting(User* user, const CommandBase::Params& parameters);
/** Encode a parameter for server->server transmission.
* Used for parameters for which the translation type is TR_CUSTOM.
@@ -219,7 +221,7 @@ class CoreExport Command : public CommandBase
* @param user The user who issued the command.
* @return Return CMD_SUCCESS on success, or CMD_FAILURE on failure.
*/
- virtual CmdResult Handle(const std::vector<std::string>& parameters, User* user) = 0;
+ virtual CmdResult Handle(User* user, const Params& parameters) = 0;
/** Register this object in the CommandParser
*/
@@ -236,10 +238,10 @@ class CoreExport SplitCommand : public Command
public:
SplitCommand(Module* me, const std::string &cmd, unsigned int minpara = 0, unsigned int maxpara = 0)
: Command(me, cmd, minpara, maxpara) {}
- CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE;
- virtual CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
- virtual CmdResult HandleRemote(const std::vector<std::string>& parameters, RemoteUser* user);
- virtual CmdResult HandleServer(const std::vector<std::string>& parameters, FakeUser* user);
+ CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
+ virtual CmdResult HandleLocal(LocalUser* user, const Params& parameters);
+ virtual CmdResult HandleRemote(RemoteUser* user, const Params& parameters);
+ virtual CmdResult HandleServer(FakeUser* user, const Params& parameters);
};
/** Shortcut macros for defining translation lists
diff --git a/include/inspircd.h b/include/inspircd.h
index b028280f7..7180fd672 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -72,6 +72,7 @@ struct fakederef
#include "cull_list.h"
#include "extensible.h"
#include "fileutils.h"
+#include "ctables.h"
#include "numerics.h"
#include "numeric.h"
#include "uid.h"
@@ -83,7 +84,6 @@ struct fakederef
#include "logger.h"
#include "usermanager.h"
#include "socket.h"
-#include "ctables.h"
#include "command_parse.h"
#include "mode.h"
#include "socketengine.h"
diff --git a/include/modules.h b/include/modules.h
index 9355712bf..432e70752 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -720,7 +720,7 @@ class CoreExport Module : public classbase, public usecountbase
* @param original_line The entire original line as passed to the parser from the user
* @return 1 to block the command, 0 to allow
*/
- virtual ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, LocalUser *user, bool validated, const std::string &original_line);
+ virtual ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated, const std::string& original_line);
/** Called after any command has been executed.
* This event occurs for all registered commands, wether they are registered in the core,
@@ -733,7 +733,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(Command* command, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line);
+ virtual void OnPostCommand(Command* command, const CommandBase::Params& 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/include/modules/sasl.h b/include/modules/sasl.h
index 0a7b19a70..8a54cfdb3 100644
--- a/include/modules/sasl.h
+++ b/include/modules/sasl.h
@@ -29,5 +29,5 @@ class SASLEventListener : public Events::ModuleEventListener
{
}
- virtual void OnSASLAuth(const parameterlist& params) = 0;
+ virtual void OnSASLAuth(const CommandBase::Params& params) = 0;
};
diff --git a/include/numeric.h b/include/numeric.h
index 85f2f13f0..cc9f9cc9b 100644
--- a/include/numeric.h
+++ b/include/numeric.h
@@ -34,7 +34,7 @@ class Numeric::Numeric
/** Parameters of the numeric
*/
- std::vector<std::string> params;
+ CommandBase::Params params;
/** Source server of the numeric, if NULL (the default) then it is the local server
*/
@@ -78,10 +78,10 @@ class Numeric::Numeric
/** Get the parameters of the numeric
* @return Parameters of the numeric as a const vector of strings
*/
- const std::vector<std::string>& GetParams() const { return params; }
+ const CommandBase::Params& GetParams() const { return params; }
/** Get the parameters of the numeric
* @return Parameters of the numeric as a vector of strings
*/
- std::vector<std::string>& GetParams() { return params; }
+ CommandBase::Params& GetParams() { return params; }
};
diff --git a/include/protocol.h b/include/protocol.h
index 7a2908a4c..a7c727e8c 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -24,8 +24,6 @@
class User;
-typedef std::vector<std::string> parameterlist;
-
class ProtocolServer
{
public:
@@ -66,7 +64,7 @@ class CoreExport ProtocolInterface
* and the message was sent, false if it was not found.
* ENCAP (should) be used instead of creating new protocol messages for easier third party application support.
*/
- virtual bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const parameterlist& params, User* source = NULL) { return false; }
+ virtual bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source = NULL) { return false; }
/** Send an ENCAP message to all servers.
* See the protocol documentation for the purpose of ENCAP.
@@ -76,7 +74,7 @@ class CoreExport ProtocolInterface
* or NULL which is equivalent to the local server
* @param omit If non-NULL the message won't be sent in the direction of this server, useful for forwarding messages
*/
- virtual void BroadcastEncap(const std::string& cmd, const parameterlist& params, User* source = NULL, User* omit = NULL) { }
+ virtual void BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source = NULL, User* omit = NULL) { }
/** Send metadata for a channel to other linked servers.
* @param chan The channel to send metadata for