From 8871a024436cb1600a30b2d0346fe9f59f3036e5 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 24 Jan 2015 14:06:42 +0100 Subject: Switch to unsigned ints in CommandBase constructor for min and max params --- include/ctables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/ctables.h b/include/ctables.h index a69f5c86f..89f3c80fe 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -163,7 +163,7 @@ class CoreExport CommandBase : public ServiceProvider * @param maxpara Maximum number of parameters this command may have - extra parameters * will be tossed into one last space-seperated param. */ - CommandBase(Module* me, const std::string &cmd, int minpara = 0, int maxpara = 0) : + CommandBase(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0) : ServiceProvider(me, cmd, SERVICE_COMMAND), flags_needed(0), min_params(minpara), max_params(maxpara), use_count(0), disabled(false), works_before_reg(false), allow_empty_last_param(true), Penalty(1) -- cgit v1.2.3 From ae7b6b9104e8889426a14cbe41704d9816e566f9 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 24 Jan 2015 14:08:02 +0100 Subject: Remove unused CommandBase::DecodeParameter() --- include/ctables.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'include') diff --git a/include/ctables.h b/include/ctables.h index 89f3c80fe..024525246 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -184,16 +184,6 @@ class CoreExport CommandBase : public ServiceProvider { } - /** Decode a parameter from server->server transmission. - * Not currently used in this version of InspIRCd. - * Used for parameters for which the translation type is TR_CUSTOM. - * @param parameter The parameter to decode. Can be modified in place. - * @param index The parameter index (0 == first parameter). - */ - virtual void DecodeParameter(std::string& parameter, int index) - { - } - /** Disable or enable this command. * @param setting True to disable the command. */ -- cgit v1.2.3 From b127d368e33aa89ed567c438f905bdf3f263891c Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 24 Jan 2015 14:10:38 +0100 Subject: Move implementation of Command and CommandBase functions into a source file --- include/ctables.h | 22 ++++------------------ src/command_parse.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/ctables.h b/include/ctables.h index 024525246..abf65f561 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -163,26 +163,16 @@ class CoreExport CommandBase : public ServiceProvider * @param maxpara Maximum number of parameters this command may have - extra parameters * will be tossed into one last space-seperated param. */ - CommandBase(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0) : - ServiceProvider(me, cmd, SERVICE_COMMAND), flags_needed(0), min_params(minpara), max_params(maxpara), - use_count(0), disabled(false), works_before_reg(false), allow_empty_last_param(true), - Penalty(1) - { - } + CommandBase(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0); - virtual RouteDescriptor GetRouting(User* user, const std::vector& parameters) - { - return ROUTE_LOCALONLY; - } + virtual RouteDescriptor GetRouting(User* user, const std::vector& parameters); /** Encode a parameter for server->server transmission. * Used for parameters for which the translation type is TR_CUSTOM. * @param parameter The parameter to encode. Can be modified in place. * @param index The parameter index (0 == first parameter). */ - virtual void EncodeParameter(std::string& parameter, int index) - { - } + virtual void EncodeParameter(std::string& parameter, int index); /** Disable or enable this command. * @param setting True to disable the command. @@ -219,11 +209,7 @@ class CoreExport Command : public CommandBase */ bool force_manual_route; - Command(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0) - : CommandBase(me, cmd, minpara, maxpara) - , force_manual_route(false) - { - } + Command(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0); /** Handle the command from a user. * @param parameters The parameters for the command. diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 793569d5b..c93dac65f 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -327,10 +327,38 @@ void CommandParser::RemoveCommand(Command* x) cmdlist.erase(n); } +CommandBase::CommandBase(Module* mod, const std::string& cmd, unsigned int minpara, unsigned int maxpara) + : ServiceProvider(mod, cmd, SERVICE_COMMAND) + , flags_needed(0) + , min_params(minpara) + , max_params(maxpara) + , use_count(0) + , disabled(false) + , works_before_reg(false) + , allow_empty_last_param(true) + , Penalty(1) +{ +} + CommandBase::~CommandBase() { } +void CommandBase::EncodeParameter(std::string& parameter, int index) +{ +} + +RouteDescriptor CommandBase::GetRouting(User* user, const std::vector& parameters) +{ + return ROUTE_LOCALONLY; +} + +Command::Command(Module* mod, const std::string& cmd, unsigned int minpara, unsigned int maxpara) + : CommandBase(mod, cmd, minpara, maxpara) + , force_manual_route(false) +{ +} + Command::~Command() { ServerInstance->Parser.RemoveCommand(this); -- cgit v1.2.3