diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bots.cpp | 1 | ||||
-rw-r--r-- | src/command.cpp | 2 | ||||
-rw-r--r-- | src/commands.c | 26 | ||||
-rw-r--r-- | src/modules.c | 24 |
4 files changed, 27 insertions, 26 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index 37cd553d1..e663d9225 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -10,6 +10,7 @@ #include "services.h" #include "modules.h" +#include "commands.h" BotInfo::BotInfo(const std::string &nnick, const std::string &nuser, const std::string &nhost, const std::string &nreal) { diff --git a/src/command.cpp b/src/command.cpp index ea66a7261..fc745fe46 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -10,7 +10,7 @@ #include "services.h" #include "modules.h" -Command::Command(const std::string &sname, size_t min_params, size_t max_params, const std::string &spermission) : MaxParams(max_params), MinParams(min_params), name(sname), permission(spermission) +Command::Command(const ci::string &sname, size_t min_params, size_t max_params, const std::string &spermission) : MaxParams(max_params), MinParams(min_params), name(sname), permission(spermission) { this->core = 0; this->mod_name = NULL; diff --git a/src/commands.c b/src/commands.c index 19d668137..40363a7d1 100644 --- a/src/commands.c +++ b/src/commands.c @@ -12,13 +12,37 @@ */ #include "services.h" -#include "commands.h" +#include "modules.h" #include "language.h" #include "hashcomp.h" /*************************************************************************/ /** + * Search the command table gieven for a command. + * @param cmdTable the name of the command table to search + * @param name the name of the command to look for + * @return returns a pointer to the found command struct, or NULL + */ +Command *findCommand(CommandHash * cmdTable[], const char *name) +{ + int idx; + CommandHash *current = NULL; + if (!cmdTable || !name) { + return NULL; + } + + idx = CMD_HASH(name); + + for (current = cmdTable[idx]; current; current = current->next) { + if (stricmp(name, current->name) == 0) { + return current->c; + } + } + return NULL; +} + +/** * Return the Command corresponding to the given name, or NULL if no such * command exists. * @param list Command struct diff --git a/src/modules.c b/src/modules.c index 40c10144f..af3aa2f4d 100644 --- a/src/modules.c +++ b/src/modules.c @@ -362,30 +362,6 @@ int Module::DelCommand(CommandHash * cmdTable[], const char *dname) return status; } -/** - * Search the command table gieven for a command. - * @param cmdTable the name of the command table to search - * @param name the name of the command to look for - * @return returns a pointer to the found command struct, or NULL - */ -Command *findCommand(CommandHash * cmdTable[], const char *name) -{ - int idx; - CommandHash *current = NULL; - if (!cmdTable || !name) { - return NULL; - } - - idx = CMD_HASH(name); - - for (current = cmdTable[idx]; current; current = current->next) { - if (stricmp(name, current->name) == 0) { - return current->c; - } - } - return NULL; -} - /******************************************************************************* * Message Functions *******************************************************************************/ |