]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_globops.cpp
Update copyright headers.
[user/henk/code/inspircd.git] / src / modules / m_globops.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2013, 2018-2019 Sadie Powell <sadie@witchery.services>
5  *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
6  *   Copyright (C) 2012 Attila Molnar <attilamolnar@hush.com>
7  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
8  *   Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
9  *   Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
10  *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
11  *   Copyright (C) 2006, 2010 Craig Edwards <brain@inspircd.org>
12  *
13  * This file is part of InspIRCd.  InspIRCd is free software: you can
14  * redistribute it and/or modify it under the terms of the GNU General Public
15  * License as published by the Free Software Foundation, version 2.
16  *
17  * This program is distributed in the hope that it will be useful, but WITHOUT
18  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
20  * details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24  */
25
26
27 // Globops and snomask +g module by C.J.Edwards
28
29 #include "inspircd.h"
30
31 /** Handle /GLOBOPS
32  */
33 class CommandGlobops : public Command
34 {
35  public:
36         CommandGlobops(Module* Creator) : Command(Creator,"GLOBOPS", 1,1)
37         {
38                 flags_needed = 'o'; syntax = ":<message>";
39         }
40
41         CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
42         {
43                 if (parameters[0].empty())
44                 {
45                         user->WriteNumeric(ERR_NOTEXTTOSEND, "No text to send");
46                         return CMD_FAILURE;
47                 }
48
49                 ServerInstance->SNO->WriteGlobalSno('g', "From " + user->nick + ": " + parameters[0]);
50                 return CMD_SUCCESS;
51         }
52 };
53
54 class ModuleGlobops : public Module
55 {
56         CommandGlobops cmd;
57  public:
58         ModuleGlobops() : cmd(this) {}
59
60         void init() CXX11_OVERRIDE
61         {
62                 ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
63         }
64
65         Version GetVersion() CXX11_OVERRIDE
66         {
67                 return Version("Provides the GLOBOPS command and snomask 'g'", VF_VENDOR);
68         }
69 };
70
71 MODULE_INIT(ModuleGlobops)