2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 class CommandTest : public Command
25 CommandTest(Module* parent) : Command(parent, "TEST", 1)
27 syntax = "<action> <parameters>";
30 CmdResult Handle(const std::vector<std::string> ¶meters, User *user)
32 if (parameters[0] == "flood")
34 unsigned int count = parameters.size() > 1 ? atoi(parameters[1].c_str()) : 100;
35 std::string line = parameters.size() > 2 ? parameters[2] : ":z.z NOTICE !flood :Flood text";
36 for(unsigned int i=0; i < count; i++)
39 else if (parameters[0] == "freeze" && IS_LOCAL(user) && parameters.size() > 1)
41 IS_LOCAL(user)->CommandFloodPenalty += atoi(parameters[1].c_str());
47 class ModuleTest : public Module
51 ModuleTest() : cmd(this)
55 void init() CXX11_OVERRIDE
57 if (!strstr(ServerInstance->Config->ServerName.c_str(), ".test"))
58 throw ModuleException("Don't load modules without reading their descriptions!");
61 Version GetVersion() CXX11_OVERRIDE
63 return Version("Provides a module for testing the server while linked in a network", VF_VENDOR|VF_OPTCOMMON);
67 MODULE_INIT(ModuleTest)