InspIRCd  4.0
Classes | Public Member Functions | Public Attributes | List of all members
CommandBase Class Reference

#include <ctables.h>

Inheritance diagram for CommandBase:
ServiceProvider Cullable insp::uncopiable Command SplitCommand

Classes

class  Params
 

Public Member Functions

 CommandBase (Module *me, const std::string &cmd, unsigned int minpara=0, unsigned int maxpara=0)
 
virtual RouteDescriptor GetRouting (User *user, const CommandBase::Params &parameters)
 
virtual void EncodeParameter (std::string &parameter, unsigned int index)
 
- Public Member Functions inherited from ServiceProvider
 ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type)
 
const char * GetTypeString () const
 
virtual void RegisterService ()
 
void DisableAutoRegister ()
 
- Public Member Functions inherited from Cullable
virtual ~Cullable ()
 
virtual Result Cull ()
 

Public Attributes

const unsigned int min_params
 
const unsigned int max_params
 
bool allow_empty_last_param = true
 
std::vector< TranslateType > translation
 
- Public Attributes inherited from ServiceProvider
ModuleRef creator
 
const std::string name
 
const ServiceType service
 

Additional Inherited Members

- Protected Member Functions inherited from Cullable
 Cullable ()
 

Detailed Description

A structure that defines a command. Every command available in InspIRCd must be defined as derived from Command.

Constructor & Destructor Documentation

◆ CommandBase()

CommandBase::CommandBase ( Module me,
const std::string &  cmd,
unsigned int  minpara = 0,
unsigned int  maxpara = 0 
)

Create a new command.

Parameters
meThe module which created this command.
cmdCommand name. This must be UPPER CASE.
minparaMinimum parameters required for the command.
maxparaMaximum number of parameters this command may have - extra parameters will be tossed into one last space-separated param.

Member Function Documentation

◆ EncodeParameter()

void CommandBase::EncodeParameter ( std::string &  parameter,
unsigned int  index 
)
virtual

Encode a parameter for server->server transmission. Used for parameters for which the translation type is TR_CUSTOM.

Parameters
parameterThe parameter to encode. Can be modified in place.
indexThe parameter index (0 == first parameter).

Member Data Documentation

◆ allow_empty_last_param

bool CommandBase::allow_empty_last_param = true

True if the command allows an empty last parameter. When false and the last parameter is empty, it's popped BEFORE checking there are enough params, etc. (i.e. the handler won't be called if there aren't enough params after popping the empty param). True by default

◆ max_params

const unsigned int CommandBase::max_params

Maximum number of parameters command takes. This is used by the command parser to join extra parameters into one last param. If not set, no munging is done to this command.

◆ min_params

const unsigned int CommandBase::min_params

Minimum number of parameters command takes

◆ translation

std::vector<TranslateType> CommandBase::translation

Translation type list for possible parameters, used to tokenize parameters into UIDs and SIDs etc.


The documentation for this class was generated from the following files: