diff options
author | Adam <Adam@anope.org> | 2012-12-19 08:48:04 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-12-19 08:48:23 -0500 |
commit | 784683a68dc3882f9507b9d304f4adf10fb403ae (patch) | |
tree | 7fa9d69db84f9a382bf5688adc5a007186e39a14 /modules/pseudoclients/operserv.cpp | |
parent | 3b2094301d6cfb6ef4e17746c93a31f82d21a703 (diff) |
Having these references to bots bugged out older compilers, so simplify this by just moving pointers to the core
Diffstat (limited to 'modules/pseudoclients/operserv.cpp')
-rw-r--r-- | modules/pseudoclients/operserv.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 5b61c3df9..02ec216f4 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -175,24 +175,22 @@ class OperServCore : public Module { this->SetAuthor("Anope"); - BotInfo *bi = BotInfo::Find(Config->OperServ); - if (!bi) + OperServ = BotInfo::Find(Config->OperServ); + if (!OperServ) throw ModuleException("No bot named " + Config->OperServ); - Implementation i[] = { I_OnBotPrivmsg, I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp }; + Implementation i[] = { I_OnBotDelete, I_OnBotPrivmsg, I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect, I_OnUserNickChange, I_OnPreHelp }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); /* Yes, these are in this order for a reason. Most violent->least violent. */ XLineManager::RegisterXLineManager(&sglines); XLineManager::RegisterXLineManager(&sqlines); XLineManager::RegisterXLineManager(&snlines); - - Service::AddAlias("BotInfo", "OperServ", bi->nick); } ~OperServCore() { - Service::DelAlias("BotInfo", "OperServ"); + OperServ = NULL; this->sglines.Clear(); this->sqlines.Clear(); @@ -203,6 +201,12 @@ class OperServCore : public Module XLineManager::UnregisterXLineManager(&snlines); } + void OnBotDelete(BotInfo *bi) anope_override + { + if (bi == OperServ) + OperServ = NULL; + } + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override { if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ) |