1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 18:06:39 +02:00

Rewrote how commands are handled within Anope.

This allows naming commands and having spaces within command names.
This commit is contained in:
Adam
2011-07-14 02:31:12 -04:00
parent 924f6849fe
commit f858164dee
227 changed files with 8808 additions and 12352 deletions
-43
View File
@@ -65,49 +65,6 @@ std::vector<Message *> Anope::FindMessage(const Anope::string &name)
return messages;
}
/*******************************************************************************
* Command Functions
*******************************************************************************/
int Module::AddCommand(BotInfo *bi, Command *c)
{
if (!bi || !c)
return MOD_ERR_PARAMS;
c->module = this;
c->service = bi;
std::pair<CommandMap::iterator, bool> it = bi->Commands.insert(std::make_pair(c->name, c));
if (it.second != true)
{
Log() << "Error creating command " << c->name << ". Command already exists!";
return MOD_ERR_EXISTS;
}
return MOD_ERR_OK;
}
/**
* Delete a command from the service given.
* @param cmdTable the cmdTable for the services to remove the command from
* @param name the name of the command to delete from the service
* @return returns MOD_ERR_OK on success
*/
int Module::DelCommand(BotInfo *bi, Command *c)
{
if (!bi || !c)
return MOD_ERR_PARAMS;
if (!bi->Commands.erase(c->name))
return MOD_ERR_NOEXIST;
c->module = NULL;
c->service = NULL;
return MOD_ERR_OK;
}
Service::Service(Module *o, const Anope::string &n) : owner(o), name(n)
{
}