]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_globops.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_globops.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 // Globops and +g support module by C.J.Edwards
15
16 #include "inspircd.h"
17
18 /* $ModDesc: Provides support for GLOBOPS and user mode +g */
19
20 /** Handle /GLOBOPS
21  */
22 class CommandGlobops : public Command
23 {
24  public:
25         CommandGlobops(Module* Creator) : Command(Creator,"GLOBOPS", 1,1)
26         {
27                 flags_needed = 'o'; syntax = "<any-text>";
28                 TRANSLATE2(TR_TEXT, TR_END);
29         }
30
31         CmdResult Handle (const std::vector<std::string> &parameters, User *user)
32         {
33                 std::string line = "From " + std::string(user->nick) + ": ";
34                 for (int i = 0; i < (int)parameters.size(); i++)
35                 {
36                         line = line + parameters[i] + " ";
37                 }
38                 ServerInstance->SNO->WriteToSnoMask('g',line);
39
40                 /* route it (ofc :p) */
41                 return CMD_SUCCESS;
42         }
43
44         RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
45         {
46                 return ROUTE_BROADCAST;
47         }
48 };
49
50 class ModuleGlobops : public Module
51 {
52         CommandGlobops cmd;
53  public:
54         ModuleGlobops()
55                 : cmd(this)
56         {
57                 ServerInstance->AddCommand(&cmd);
58                 ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
59
60         }
61
62         virtual ~ModuleGlobops()
63         {
64                 ServerInstance->SNO->DisableSnomask('g');
65         }
66
67         virtual Version GetVersion()
68         {
69                 return Version("Provides support for GLOBOPS and user mode +g", VF_COMMON | VF_VENDOR);
70         }
71
72 };
73
74 MODULE_INIT(ModuleGlobops)