diff options
author | Adam <Adam@anope.org> | 2011-04-22 03:16:11 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-05-16 04:06:17 -0400 |
commit | c8c23158a4ff74822d6c7d201dc53d879e3d91e8 (patch) | |
tree | 4bc9ae029691d5e7c03ebc1481683a010b733844 /modules/core/gl_global.cpp | |
parent | 1782ce260c5bc214ec0b2e39257ab1371b68ae9c (diff) |
Moved the core pseudo clients out into their own modules
Diffstat (limited to 'modules/core/gl_global.cpp')
-rw-r--r-- | modules/core/gl_global.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/modules/core/gl_global.cpp b/modules/core/gl_global.cpp new file mode 100644 index 000000000..e03c3f788 --- /dev/null +++ b/modules/core/gl_global.cpp @@ -0,0 +1,67 @@ +/* Global core functions + * + * (C) 2003-2011 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 "global.h" + +class CommandGLGlobal : public Command +{ + public: + CommandGLGlobal() : Command("GLOBAL", 1, 1, "global/global") + { + this->SetDesc(_("Send a message to all users")); + } + + CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) + { + User *u = source.u; + const Anope::string &msg = params[0]; + + Log(LOG_ADMIN, u, this); + global->SendGlobal(global->Bot(), u->nick, msg); + return MOD_CONT; + } + + bool OnHelp(CommandSource &source, const Anope::string &subcommand) + { + source.Reply(_("Syntax: \002GLOBAL \037message\037\002\n" + " \n" + "Allows Administrators to send messages to all users on the \n" + "network. The message will be sent from the nick \002%s\002."), Config->s_Global.c_str()); + return true; + } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) + { + SyntaxError(source, "GLOBAL", _("GLOBAL \037message\037")); + } +}; + +class GLGlobal : public Module +{ + CommandGLGlobal commandglglobal; + + public: + GLGlobal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetType(CORE); + + if (Config->s_Global.empty()) + throw ModuleException("Global is disabled"); + + this->AddCommand(global->Bot(), &commandglglobal); + } +}; + +MODULE_INIT(GLGlobal) |