1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 02:26:38 +02:00

Don't dynamically allocate commands in modules anymore, instead made them members of modules. This means the commands are automatically destructed when the module is unloaded. Cleans up some old ugly code.

This commit is contained in:
Adam
2010-07-31 21:37:45 -04:00
parent 9d0d44d738
commit c770c47e18
149 changed files with 743 additions and 444 deletions
-75
View File
@@ -40,81 +40,6 @@ Module::~Module()
/* Clear any active callbacks this module has */
ModuleManager::ClearCallBacks(this);
/**
* ok, im going to walk every hash looking for commands we own, now, not exactly elegant or efficiant :)
**/
if (HostServ)
{
for (CommandMap::iterator it = HostServ->Commands.begin(), it_end = HostServ->Commands.end(); it != it_end; )
{
Command *c = it->second;
++it;
if (c->module == this)
this->DelCommand(HostServ, c);
}
}
if (BotServ)
{
for (CommandMap::iterator it = BotServ->Commands.begin(), it_end = BotServ->Commands.end(); it != it_end; )
{
Command *c = it->second;
++it;
if (c->module == this)
this->DelCommand(BotServ, c);
}
}
if (MemoServ)
{
for (CommandMap::iterator it = MemoServ->Commands.begin(), it_end = MemoServ->Commands.end(); it != it_end; )
{
Command *c = it->second;
++it;
if (c->module == this)
this->DelCommand(MemoServ, c);
}
}
if (NickServ)
{
for (CommandMap::iterator it = NickServ->Commands.begin(), it_end = NickServ->Commands.end(); it != it_end; )
{
Command *c = it->second;
++it;
if (c->module == this)
this->DelCommand(NickServ, c);
}
}
if (ChanServ)
{
for (CommandMap::iterator it = ChanServ->Commands.begin(), it_end = ChanServ->Commands.end(); it != it_end; )
{
Command *c = it->second;
++it;
if (c->module == this)
this->DelCommand(ChanServ, c);
}
}
if (OperServ)
{
for (CommandMap::iterator it = OperServ->Commands.begin(), it_end = OperServ->Commands.end(); it != it_end; )
{
Command *c = it->second;
++it;
if (c->module == this)
this->DelCommand(OperServ, c);
}
}
std::list<Module *>::iterator it = std::find(Modules.begin(), Modules.end(), this);
if (it != Modules.end())
Modules.erase(it);