X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fctables.h;h=bc4226ea93b5c7b73165fc748086c25195fd74ec;hb=7770cd985405c7630e9149fc08c314ec824a9c75;hp=747901459b67a98dd6d7b99d4b042da6fbbb1ff5;hpb=1031f333332cf1b09db4fd632f141143ee637c34;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/ctables.h b/include/ctables.h index 747901459..bc4226ea9 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -75,10 +75,17 @@ struct RouteDescriptor */ std::string serverdest; + /** For unicast, the destination Server + */ + Server* server; + /** Create a RouteDescriptor */ RouteDescriptor(RouteType t, const std::string &d) - : type(t), serverdest(d) { } + : type(t), serverdest(d), server(NULL) { } + + RouteDescriptor(RouteType t, Server* srv) + : type(t), server(srv) { } }; /** Do not route this command */ @@ -156,36 +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, int minpara = 0, 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) - { - } - - /** 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) - { - } + virtual void EncodeParameter(std::string& parameter, int index); /** Disable or enable this command. * @param setting True to disable the command. @@ -217,10 +204,12 @@ class CoreExport CommandBase : public ServiceProvider class CoreExport Command : public CommandBase { public: - Command(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0) - : CommandBase(me, cmd, minpara, maxpara) - { - } + /** If true, the command will not be forwarded by the linking module even if it comes via ENCAP. + * Can be used to forward commands before their effects. + */ + bool force_manual_route; + + 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. @@ -229,6 +218,10 @@ class CoreExport Command : public CommandBase */ virtual CmdResult Handle(const std::vector& parameters, User* user) = 0; + /** Register this object in the CommandParser + */ + void RegisterService() CXX11_OVERRIDE; + /** Destructor * Removes this command from the command parser */