1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 08:03:12 +02:00

Get rid of the remaining references in the core to specific services. Move more stuff out of the core to the proper modules.

This commit is contained in:
Adam
2013-05-26 17:13:11 -04:00
parent f2dee1e1d6
commit 22658d63bd
164 changed files with 835 additions and 2137 deletions
+5 -17
View File
@@ -9,12 +9,11 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class HostServCore : public Module
{
Reference<BotInfo> HostServ;
public:
HostServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PSEUDOCLIENT | VENDOR)
{
@@ -22,36 +21,25 @@ class HostServCore : public Module
if (!IRCD || !IRCD->CanSetVHost)
throw ModuleException("Your IRCd does not support vhosts");
Implementation i[] = { I_OnReload, I_OnBotDelete, I_OnNickIdentify, I_OnNickUpdate, I_OnPreHelp,
Implementation i[] = { I_OnReload, I_OnNickIdentify, I_OnNickUpdate, I_OnPreHelp,
I_OnSetVhost, I_OnDeleteVhost };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
~HostServCore()
{
HostServ = NULL;
}
void OnReload(Configuration::Conf *conf) anope_override
{
const Anope::string &hsnick = conf->GetModule(this)->Get<const Anope::string>("client");
if (hsnick.empty())
throw ConfigException(this->name + ": <client> must be defined");
throw ConfigException(Module::name + ": <client> must be defined");
BotInfo *bi = BotInfo::Find(hsnick, true);
if (!bi)
throw ConfigException(this->name + ": no bot named " + hsnick);
throw ConfigException(Module::name + ": no bot named " + hsnick);
HostServ = bi;
}
void OnBotDelete(BotInfo *bi) anope_override
{
if (bi == HostServ)
HostServ = NULL;
}
void OnNickIdentify(User *u) anope_override
{
const NickAlias *na = NickAlias::Find(u->nick);
@@ -87,7 +75,7 @@ class HostServCore : public Module
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
if (!params.empty() || source.c || source.service != HostServ)
if (!params.empty() || source.c || source.service != *HostServ)
return EVENT_CONTINUE;
source.Reply(_("%s commands:"), HostServ->nick.c_str());
return EVENT_CONTINUE;