InspIRCd  4.0
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Command Class Referenceabstract
Inheritance diagram for Command:
CommandBase ServiceProvider Cullable insp::uncopiable SplitCommand

Public Member Functions

 ~Command () override
 
virtual CmdResult Handle (User *user, const Params &parameters)=0
 
void RegisterService () override
 
virtual void TellNotEnoughParameters (LocalUser *user, const Params &parameters)
 
virtual void TellNotRegistered (LocalUser *user, const Params &parameters)
 
- Public Member Functions inherited from CommandBase
 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
 
void DisableAutoRegister ()
 
- Public Member Functions inherited from Cullable
virtual ~Cullable ()
 
virtual Result Cull ()
 

Public Attributes

CmdAccess access_needed = CmdAccess::NORMAL
 
bool force_manual_route = false
 
unsigned int Penalty = 1
 
unsigned long use_count = 0
 
std::vector< std::string > syntax
 
bool works_before_reg = false
 
- Public Attributes inherited from CommandBase
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
 

Protected Member Functions

 Command (Module *me, const std::string &cmd, unsigned int minpara=0, unsigned int maxpara=0)
 
- Protected Member Functions inherited from Cullable
 Cullable ()
 

Constructor & Destructor Documentation

◆ Command()

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

Initializes a new instance of the Command class.

Parameters
meThe module which created this instance.
cmdThe name of the command.
minparaThe minimum number of parameters that the command accepts.
maxparaThe maximum number of parameters that the command accepts.

◆ ~Command()

Command::~Command ( )
override

Unregisters this command from the command parser.

Member Function Documentation

◆ Handle()

virtual CmdResult Command::Handle ( User user,
const Params parameters 
)
pure virtual

Handle the command from a user.

Parameters
userThe user who issued the command.
parametersThe parameters for the command.
Returns
Returns CmdResult::FAILURE on failure, CmdResult::SUCCESS on success, or CmdResult::INVALID if the command was malformed.

Implemented in SplitCommand.

◆ RegisterService()

void Command::RegisterService ( )
overridevirtual

Registers this command with the command parser.

Reimplemented from ServiceProvider.

◆ TellNotEnoughParameters()

void Command::TellNotEnoughParameters ( LocalUser user,
const Params parameters 
)
virtual

Tells the user they did not specify enough parameters.

Parameters
userThe user who issued the command.
parametersThe parameters for the command.

◆ TellNotRegistered()

void Command::TellNotRegistered ( LocalUser user,
const Params parameters 
)
virtual

Tells the user they need to be registered to execute this command.

Parameters
userThe user who issued the command.
parametersThe parameters for the command.

Member Data Documentation

◆ access_needed

CmdAccess Command::access_needed = CmdAccess::NORMAL

Who can access this command?

◆ force_manual_route

bool Command::force_manual_route = false

Whether the command will not be forwarded by the linking module even if it comes via ENCAP.

◆ Penalty

unsigned int Command::Penalty = 1

The number of seconds worth of penalty that executing this command gives.

◆ syntax

std::vector<std::string> Command::syntax

If non-empty then the syntax of the parameter for this command.

◆ use_count

unsigned long Command::use_count = 0

The number of times this command has been executed.

◆ works_before_reg

bool Command::works_before_reg = false

Whether the command can be issued before registering.


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