|
|||
|
|||
|
#include <command_parse.h>
Inheritance diagram for CommandParser:


Public Member Functions | |
| bool | ReloadCommand (std::string cmd, User *user) |
| Reload a core command. | |
| CommandParser (InspIRCd *Instance) | |
| Default constructor. | |
| CmdResult | CallHandler (const std::string &commandname, const std::vector< std::string > ¶meters, User *user) |
| Calls the handler for a given command. | |
| Command * | GetHandler (const std::string &commandname) |
| Get the handler function for a command. | |
| bool | IsValidCommand (const std::string &commandname, unsigned int pcnt, User *user) |
| This function returns true if a command is valid with the given number of parameters and user. | |
| int | LoopCall (User *user, Command *CommandObj, const std::vector< std::string > ¶meters, unsigned int splithere, unsigned int extra) |
| LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list. | |
| int | LoopCall (User *user, Command *CommandObj, const std::vector< std::string > ¶meters, unsigned int splithere) |
| LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list. | |
| bool | ProcessBuffer (std::string &buffer, User *user) |
| Take a raw input buffer from a recvq, and process it on behalf of a user. | |
| void | DoLines (User *current, bool one_only=false) |
| Process lines in a users sendq. | |
| void | RemoveCommands (const char *source) |
| Remove all commands relating to module 'source'. | |
| bool | CreateCommand (Command *f, void *so_handle=NULL) |
| Add a new command to the commands hash. | |
| void | SetupCommandTable (User *user) |
| Insert the default RFC1459 commands into the command hash. | |
| int | TranslateUIDs (TranslateType to, const std::string &source, std::string &dest) |
| Translate nicknames in a string into UIDs, based on the TranslationType given. | |
Public Attributes | |
| Commandtable | cmdlist |
| Command list, a hash_map of command names to Command*. | |
Private Member Functions | |
| int | ProcessParameters (std::vector< std::string > &command_p, char *parameters) |
| Process a parameter string into a list of items. | |
| bool | ProcessCommand (User *user, std::string &cmd) |
| Process a command from a user. | |
| bool | FindSym (void **v, void *h, const std::string &name) |
| Finds the init_command symbol in a .so file. | |
| const char * | LoadCommand (const char *name) |
| Load a command from a shared object on disk. | |
| void | RemoveCommand (nspace::hash_map< std::string, Command * >::iterator safei, const char *source) |
| Removes a command if the sources match. | |
Private Attributes | |
| InspIRCd * | ServerInstance |
| The creator of this class. | |
| std::vector< std::string > | para |
| Parameter buffer. | |
| SharedObjectList | RFCCommands |
| A list of core-implemented modes and their shared object handles. | |
It allows you to add and remove commands from the map, call command handlers by name, and chop up comma seperated parameters into multiple calls.
Definition at line 26 of file command_parse.h.
|
|
Default constructor.
Definition at line 433 of file command_parse.cpp. References para. |
|
||||||||||||||||
|
Calls the handler for a given command.
Definition at line 184 of file command_parse.cpp. References CMD_INVALID, cmdlist, User::HasPermission(), IS_LOCAL, and User::IsModeSet(). Referenced by InspIRCd::CallCommandHandler(), ModuleAlias::DoCommand(), User::ForceNickChange(), CommandSVSWatch::Handle(), CommandSVSSilence::Handle(), ModuleModesOnConnect::OnPostConnect(), ModuleAntiBottler::OnPreCommand(), ModeHandler::RemoveMode(), and User::UnOper(). |
|
||||||||||||
|
Add a new command to the commands hash.
Definition at line 411 of file command_parse.cpp. References cmdlist, Command::command, DEFAULT, LogManager::Log(), InspIRCd::Logs, RFCCommands, and ServerInstance. Referenced by LoadCommand(), and SetupCommandTable(). |
|
||||||||||||
|
Process lines in a users sendq.
Definition at line 220 of file command_parse.cpp. References User::BufferIsReady(), connection::bytes_in, connection::cmds_in, InspIRCd::FloodQuitUser, User::GetBuffer(), ConnectClass::GetFlood(), ConnectClass::GetThreshold(), User::lines_in, MAXBUF, User::MyClass, InspIRCd::Parser, ProcessBuffer(), User::reset_due, ServerInstance, and InspIRCd::Time(). Referenced by InspIRCd::DoBackgroundUserStuff(). |
|
||||||||||||||||
|
Finds the init_command symbol in a .so file.
Definition at line 438 of file command_parse.cpp. References LogManager::Log(), InspIRCd::Logs, ServerInstance, and SPARSE. |
|
|
Get the handler function for a command.
Definition at line 173 of file command_parse.cpp. References cmdlist. Referenced by User::AddToWhoWas(), User::ForceNickChange(), ModuleSQLOper::LoginFail(), ModuleSpanningTree::OnPostCommand(), ModuleOperLog::OnPreCommand(), FilterBase::OnPreCommand(), ModuleInvisible::OnUserQuit(), ModuleDelayJoin::OnUserQuit(), ModuleAuditorium::OnUserQuit(), and ValidateWhoWas(). |
|
||||||||||||||||
|
This function returns true if a command is valid with the given number of parameters and user.
Definition at line 149 of file command_parse.cpp. References cmdlist, User::HasPermission(), IS_LOCAL, and User::IsModeSet(). Referenced by InspIRCd::IsValidModuleCommand(). |
|
|
Load a command from a shared object on disk.
Definition at line 501 of file command_parse.cpp. References CreateCommand(), DEBUG, LIBRARYDIR, LogManager::Log(), InspIRCd::Logs, MAXBUF, RFCCommands, ServerInstance, and SPARSE. Referenced by ReloadCommand(), and SetupCommandTable(). |
|
||||||||||||||||||||
|
LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list. There are two overriden versions of this method, one of which takes two potential lists and the other takes one. We need a version which takes two potential lists for JOIN, because a JOIN may contain two lists of items at once, the channel names and their keys as follows: JOIN chan1,chan2,chan3 key1,,key3 Therefore, we need to deal with both lists concurrently. The first instance of this method does that by creating two instances of irc::commasepstream and reading them both together until the first runs out of tokens. The second version is much simpler and just has the one stream to read, and is used in NAMES, WHOIS, PRIVMSG etc. Both will only parse until they reach ServerInstance->Config->MaxTargets number of targets, to stop abuse via spam.
Definition at line 103 of file command_parse.cpp. References InspIRCd::Config, irc::sepstream::GetToken(), Command::Handle(), MAXPARAMETERS, ServerConfig::MaxTargets, and ServerInstance. |
|
||||||||||||||||||||||||
|
LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list. There are two overriden versions of this method, one of which takes two potential lists and the other takes one. We need a version which takes two potential lists for JOIN, because a JOIN may contain two lists of items at once, the channel names and their keys as follows: JOIN chan1,chan2,chan3 key1,,key3 Therefore, we need to deal with both lists concurrently. The first instance of this method does that by creating two instances of irc::commasepstream and reading them both together until the first runs out of tokens. The second version is much simpler and just has the one stream to read, and is used in NAMES, WHOIS, PRIVMSG etc. Both will only parse until they reach ServerInstance->Config->MaxTargets number of targets, to stop abuse via spam.
Definition at line 51 of file command_parse.cpp. References InspIRCd::Config, irc::sepstream::GetToken(), Command::Handle(), MAXPARAMETERS, ServerConfig::MaxTargets, and ServerInstance. |
|
||||||||||||
|
Take a raw input buffer from a recvq, and process it on behalf of a user.
Definition at line 390 of file command_parse.cpp. References DEBUG, EventHandler::GetFd(), LogManager::Log(), InspIRCd::Logs, User::nick, ProcessCommand(), and ServerInstance. Referenced by DoLines(). |
|
||||||||||||
|
Process a command from a user.
Definition at line 261 of file command_parse.cpp. References cmdlist, InspIRCd::Config, User::ExemptFromPenalty, FOREACH_MOD, FOREACH_RESULT, ConnectClass::GetPingTime(), irc::tokenstream::GetToken(), User::HasPermission(), connection::host, I_OnPostCommand, I_OnPreCommand, User::ident, User::IncreasePenalty(), IS_OPER, User::IsModeSet(), MAXPARAMETERS, User::MyClass, User::nick, connection::nping, User::oper, User::OverPenalty, User::Penalty, REG_ALL, connection::registered, ServerInstance, InspIRCd::SNO, InspIRCd::stats, serverstats::statsUnknown, ServerConfig::SyntaxHints, InspIRCd::Time(), User::WriteNumeric(), and SnomaskManager::WriteToSnoMask(). Referenced by ProcessBuffer(). |
|
||||||||||||
|
Process a parameter string into a list of items.
|
|
||||||||||||
|
Reload a core command. This will only reload commands implemented by the core, to reload a modular command, you must reload that module.
Definition at line 450 of file command_parse.cpp. References cmdlist, LoadCommand(), MAXBUF, and RFCCommands. Referenced by cmd_reload::Handle(). |
|
||||||||||||
|
Removes a command if the sources match. Used as a helper for safe hash_map delete while iter in RemoveCommands(const char* source). Referenced by RemoveCommands(). |
|
|
Remove all commands relating to module 'source'.
Definition at line 369 of file command_parse.cpp. References cmdlist, and RemoveCommand(). Referenced by InspIRCd::Cleanup(), and ModuleManager::Unload(). |
|
|
Insert the default RFC1459 commands into the command hash. Ignore any already loaded commands.
Definition at line 532 of file command_parse.cpp. References cmdlist, CreateCommand(), EXIT_STATUS_BADHANDLER, LIBRARYDIR, LoadCommand(), match(), RFCCommands, and ServerInstance. Referenced by ServerConfig::Read(). |
|
||||||||||||||||
|
Translate nicknames in a string into UIDs, based on the TranslationType given.
Definition at line 579 of file command_parse.cpp. References InspIRCd::FindNick(), irc::sepstream::GetToken(), ServerInstance, TR_END, TR_NICK, TR_NICKLIST, TR_SPACENICKLIST, TR_TEXT, and User::uuid. Referenced by ModuleSpanningTree::OnMode(), ModuleSpanningTree::OnPostCommand(), ModuleSpanningTree::ProtoSendMode(), and SpanningTreeProtocolInterface::SendMode(). |
|
|
Command list, a hash_map of command names to Command*.
Definition at line 77 of file command_parse.h. Referenced by CallHandler(), CreateCommand(), GetHandler(), InitializeDisabledCommands(), IsValidCommand(), ModuleAbbreviation::OnPreCommand(), ProcessCommand(), ReloadCommand(), RemoveCommands(), and SetupCommandTable(). |
|
|
Parameter buffer.
Definition at line 35 of file command_parse.h. Referenced by CommandParser(). |
|
|
A list of core-implemented modes and their shared object handles.
Definition at line 60 of file command_parse.h. Referenced by CreateCommand(), LoadCommand(), ReloadCommand(), and SetupCommandTable(). |
|
|
The creator of this class.
Definition at line 31 of file command_parse.h. Referenced by CreateCommand(), DoLines(), FindSym(), LoadCommand(), LoopCall(), ProcessBuffer(), ProcessCommand(), SetupCommandTable(), and TranslateUIDs(). |