From 6302f980fe6dad83aab7d2dc1046dadea5ffd939 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Dec 2015 16:52:24 -0500 Subject: New source tree structure for modules. From commands/cs_access => chanserv/access etc. --- modules/pseudoclients/global.cpp | 107 --------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 modules/pseudoclients/global.cpp (limited to 'modules/pseudoclients/global.cpp') diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp deleted file mode 100644 index f31605acb..000000000 --- a/modules/pseudoclients/global.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* Global core functions - * - * (C) 2003-2014 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "module.h" -#include "modules/help.h" -#include "modules/global.h" - -class GlobalCore : public Module - , public Global::GlobalService - , public EventHook - , public EventHook - , public EventHook - , public EventHook -{ - Reference Global; - - void ServerGlobal(ServiceBot *sender, Server *s, const Anope::string &message) - { - if (s != Me && !s->IsJuped()) - s->Notice(sender, message); - for (unsigned i = 0, j = s->GetLinks().size(); i < j; ++i) - this->ServerGlobal(sender, s->GetLinks()[i], message); - } - - public: - GlobalCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PSEUDOCLIENT | VENDOR) - , GlobalService(this) - { - } - - void SendGlobal(ServiceBot *sender, const Anope::string &source, const Anope::string &message) override - { - if (Me->GetLinks().empty()) - return; - if (!sender) - sender = Global; - if (!sender) - return; - - Anope::string rmessage; - - if (!source.empty() && !Config->GetModule("global")->Get("anonymousglobal")) - rmessage = "[" + source + "] " + message; - else - rmessage = message; - - this->ServerGlobal(sender, Servers::GetUplink(), rmessage); - } - - void OnReload(Configuration::Conf *conf) override - { - const Anope::string &glnick = conf->GetModule(this)->Get("client"); - - if (glnick.empty()) - throw ConfigException(Module::name + ": must be defined"); - - ServiceBot *bi = ServiceBot::Find(glnick, true); - if (!bi) - throw ConfigException(Module::name + ": no bot named " + glnick); - - Global = bi; - } - - void OnRestart() override - { - const Anope::string &gl = Config->GetModule(this)->Get("globaloncycledown"); - if (!gl.empty()) - this->SendGlobal(Global, "", gl); - } - - void OnShutdown() override - { - const Anope::string &gl = Config->GetModule(this)->Get("globaloncycledown"); - if (!gl.empty()) - this->SendGlobal(Global, "", gl); - } - - void OnNewServer(Server *s) override - { - const Anope::string &gl = Config->GetModule(this)->Get("globaloncycleup"); - if (!gl.empty() && !Me->IsSynced()) - s->Notice(Global, gl); - } - - EventReturn OnPreHelp(CommandSource &source, const std::vector ¶ms) override - { - if (!params.empty() || source.c || source.service != *Global) - return EVENT_CONTINUE; - source.Reply(_("%s commands:"), Global->nick.c_str()); - return EVENT_CONTINUE; - } - - void OnPostHelp(CommandSource &source, const std::vector ¶ms) override - { - } -}; - -MODULE_INIT(GlobalCore) - -- cgit