diff options
| author | Sadie Powell <sadie@witchery.services> | 2024-01-24 12:34:03 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2024-01-24 12:34:34 +0000 |
| commit | 484160eb4ed560eeda97c94a42dd8e31431ab251 (patch) | |
| tree | 03600af16b55fa2f268904d7a42a8b87f86c09f4 /modules/pseudoclients/global.cpp | |
| parent | 7ac1fe58478d58e2480b6919c4abf3a82929169c (diff) | |
Shuffle modules around a bit.
Diffstat (limited to 'modules/pseudoclients/global.cpp')
| -rw-r--r-- | modules/pseudoclients/global.cpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp deleted file mode 100644 index a5288d754..000000000 --- a/modules/pseudoclients/global.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* Global core functions - * - * (C) 2003-2024 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" - -class GlobalCore final - : public Module - , public GlobalService -{ - Reference<BotInfo> Global; - - void ServerGlobal(BotInfo *sender, Server *s, const Anope::string &message) - { - if (s != Me && !s->IsJuped()) - s->Notice(sender, message); - for (auto *link : s->GetLinks()) - this->ServerGlobal(sender, link, message); - } - -public: - GlobalCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PSEUDOCLIENT | VENDOR), - GlobalService(this) - { - } - - Reference<BotInfo> GetDefaultSender() override - { - return Global; - } - - void SendGlobal(BotInfo *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<bool>("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<const Anope::string>("client"); - - if (glnick.empty()) - throw ConfigException(Module::name + ": <client> must be defined"); - - BotInfo *bi = BotInfo::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<const Anope::string>("globaloncycledown"); - if (!gl.empty()) - this->SendGlobal(Global, "", gl); - } - - void OnShutdown() override - { - const Anope::string &gl = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown"); - if (!gl.empty()) - this->SendGlobal(Global, "", gl); - } - - void OnNewServer(Server *s) override - { - const Anope::string &gl = Config->GetModule(this)->Get<const Anope::string>("globaloncycleup"); - if (!gl.empty() && !Me->IsSynced()) - s->Notice(Global, gl); - } - - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - if (!params.empty() || source.c || source.service != *Global) - return EVENT_CONTINUE; - source.Reply(_("%s commands:"), Global->nick.c_str()); - return EVENT_CONTINUE; - } -}; - -MODULE_INIT(GlobalCore) |
