Anope IRC Services  Version 2.0
gl_global.cpp
Go to the documentation of this file.
1 /* Global core functions
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  */
11 
12 #include "module.h"
13 
14 class CommandGLGlobal : public Command
15 {
17 
18  public:
19  CommandGLGlobal(Module *creator) : Command(creator, "global/global", 1, 1), GService("GlobalService", "Global")
20  {
21  this->SetDesc(_("Send a message to all users"));
22  this->SetSyntax(_("\037message\037"));
23  }
24 
25  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
26  {
27  const Anope::string &msg = params[0];
28 
29  if (!GService)
30  source.Reply("No global reference, is global loaded?");
31  else
32  {
33  Log(LOG_ADMIN, source, this);
34  GService->SendGlobal(NULL, source.GetNick(), msg);
35  }
36  }
37 
38  bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
39  {
40  this->SendSyntax(source);
41  source.Reply(" ");
42  source.Reply(_("Allows Administrators to send messages to all users on the\n"
43  "network. The message will be sent from the nick \002%s\002."), source.service->nick.c_str());
44  return true;
45  }
46 };
47 
48 class GLGlobal : public Module
49 {
51 
52  public:
53  GLGlobal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
54  commandglglobal(this)
55  {
56 
57  }
58 };
59 
ServiceReference< GlobalService > GService
Definition: gl_global.cpp:16
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
Definition: gl_global.cpp:38
void SetDesc(const Anope::string &d)
Definition: command.cpp:130
GLGlobal(const Anope::string &modname, const Anope::string &creator)
Definition: gl_global.cpp:53
CommandGLGlobal commandglglobal
Definition: gl_global.cpp:50
CommandGLGlobal(Module *creator)
Definition: gl_global.cpp:19
#define anope_override
Definition: services.h:56
#define MODULE_INIT(x)
Definition: modules.h:45
void SetSyntax(const Anope::string &s)
Definition: command.cpp:140
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: gl_global.cpp:25
void SendSyntax(CommandSource &)
Definition: command.cpp:145
Definition: logger.h:53
#define _(x)
Definition: services.h:50