mirror of
https://github.com/anope/anope.git
synced 2026-07-09 15:43:13 +02:00
Properly remove commands from bots when they are destructed, and run privmsgs for bots we know of but aren't the core
This commit is contained in:
@@ -72,6 +72,14 @@ BotInfo::~BotInfo()
|
||||
ci->bi = NULL;
|
||||
}
|
||||
|
||||
for (CommandMap::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it)
|
||||
{
|
||||
Command *c = it->second;
|
||||
|
||||
if (c->module)
|
||||
c->module->DelCommand(this, c);
|
||||
}
|
||||
|
||||
BotListByNick.erase(this->nick);
|
||||
if (!this->uid.empty())
|
||||
BotListByUID.erase(this->uid);
|
||||
|
||||
+3
-3
@@ -174,9 +174,7 @@ int m_privmsg(const Anope::string &source, const Anope::string &receiver, const
|
||||
ircdproto->SendCTCP(bi, u->nick, "VERSION Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::Build().c_str());
|
||||
}
|
||||
}
|
||||
if (bi == NickServ || bi == MemoServ || bi == BotServ)
|
||||
mod_run_cmd(bi, u, message);
|
||||
else if (bi == ChanServ)
|
||||
if (bi == ChanServ)
|
||||
{
|
||||
if (!is_oper(u) && Config->CSOpersOnly)
|
||||
u->SendMessage(ChanServ, ACCESS_DENIED);
|
||||
@@ -204,6 +202,8 @@ int m_privmsg(const Anope::string &source, const Anope::string &receiver, const
|
||||
mod_run_cmd(bi, u, message);
|
||||
}
|
||||
}
|
||||
else
|
||||
mod_run_cmd(bi, u, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,6 +173,9 @@ int Module::DelCommand(BotInfo *bi, Command *c)
|
||||
|
||||
if (!bi->Commands.erase(c->name))
|
||||
return MOD_ERR_NOEXIST;
|
||||
|
||||
c->module = NULL;
|
||||
c->service = NULL;
|
||||
|
||||
return MOD_ERR_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user