]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_globops.cpp
OOPS! We try again, since I'm smoking craq. LF is 0x0a NOT CR.
[user/henk/code/inspircd.git] / src / modules / m_globops.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/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 #include "users.h"
18 #include "channels.h"
19 #include "modules.h"
20
21 /* $ModDesc: Provides support for GLOBOPS and user mode +g */
22
23 /** Handle /GLOBOPS
24  */
25 class cmd_globops : public command_t
26 {
27  public:
28         cmd_globops (InspIRCd* Instance) : command_t(Instance,"GLOBOPS",'o',1)
29         {
30                 this->source = "m_globops.so";
31                 syntax = "<any-text>";
32         }
33
34         CmdResult Handle (const char** parameters, int pcnt, userrec *user)
35         {
36                 std::string line = "From " + std::string(user->nick) + ": ";
37                 for (int i = 0; i < pcnt; i++)
38                 {
39                         line = line + std::string(parameters[i]) + " ";
40                 }
41                 ServerInstance->SNO->WriteToSnoMask('g',line);
42
43                 /* route it (ofc :p) */
44                 return CMD_SUCCESS;
45         }
46 };
47
48 class ModuleGlobops : public Module
49 {
50         cmd_globops* mycommand;
51  public:
52         ModuleGlobops(InspIRCd* Me)
53                 : Module(Me)
54         {
55                 mycommand = new cmd_globops(ServerInstance);
56                 ServerInstance->AddCommand(mycommand);
57                 ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
58         }
59         
60         virtual ~ModuleGlobops()
61         {
62                 ServerInstance->SNO->DisableSnomask('g');
63                 DELETE(mycommand);
64         }
65         
66         virtual Version GetVersion()
67         {
68                 return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
69         }
70
71         void Implements(char* List)
72         {
73         }
74 };
75
76 MODULE_INIT(ModuleGlobops)