diff options
author | Adam <Adam@anope.org> | 2013-05-26 17:13:11 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-05-26 17:13:11 -0400 |
commit | 22658d63bdb1e52a66f4514af45fa55ca5891345 (patch) | |
tree | 673304ab19f7e077b489354248247867518331f8 /modules/pseudoclients/botserv.cpp | |
parent | f2dee1e1d642b07947f59f91dfba9af34ef84685 (diff) |
Get rid of the remaining references in the core to specific services. Move more stuff out of the core to the proper modules.
Diffstat (limited to 'modules/pseudoclients/botserv.cpp')
-rw-r--r-- | modules/pseudoclients/botserv.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp index 5a84d1e7f..828f3b0e2 100644 --- a/modules/pseudoclients/botserv.cpp +++ b/modules/pseudoclients/botserv.cpp @@ -9,40 +9,35 @@ * Based on the original code of Services by Andy Church. */ -/*************************************************************************/ - #include "module.h" class BotServCore : public Module { + Reference<BotInfo> BotServ; + public: BotServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PSEUDOCLIENT | VENDOR) { - Implementation i[] = { I_OnReload, I_OnSetCorrectModes, I_OnBotAssign, I_OnBotDelete, I_OnPrivmsg, I_OnJoinChannel, I_OnLeaveChannel, + Implementation i[] = { I_OnReload, I_OnSetCorrectModes, I_OnBotAssign, I_OnPrivmsg, I_OnJoinChannel, I_OnLeaveChannel, I_OnPreHelp, I_OnPostHelp, I_OnChannelModeSet, I_OnCreateChan, I_OnUserKicked, I_OnCreateBot }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } - ~BotServCore() - { - BotServ = NULL; - } - void OnReload(Configuration::Conf *conf) anope_override { const Anope::string &bsnick = conf->GetModule(this)->Get<const Anope::string>("client"); if (bsnick.empty()) - throw ConfigException(this->name + ": <client> must be defined"); + throw ConfigException(Module::name + ": <client> must be defined"); BotInfo *bi = BotInfo::Find(bsnick, true); if (!bi) - throw ConfigException(this->name + ": no bot named " + bsnick); + throw ConfigException(Module::name + ": no bot named " + bsnick); BotServ = bi; } - void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool give_modes) anope_override + void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override { /* Do not allow removing bot modes on our service bots */ if (chan->ci && chan->ci->bi == user) @@ -62,12 +57,6 @@ class BotServCore : public Module } } - void OnBotDelete(BotInfo *bi) anope_override - { - if (bi == BotServ) - BotServ = NULL; - } - void OnPrivmsg(User *u, Channel *c, Anope::string &msg) anope_override { if (!u || !c || !c->ci || !c->ci->bi || msg.empty()) @@ -256,7 +245,7 @@ class BotServCore : public Module /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly * We also don't part the bot here either, if necessary we will part it after the sync */ - if (c->HasExt("SYNCING")) + if (c->syncing) return; /* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */ @@ -305,7 +294,7 @@ class BotServCore : public Module void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!params.empty() || source.c || source.service != BotServ) + if (!params.empty() || source.c || source.service != *BotServ) return; source.Reply(_(" \n" |