1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 /* $ModDesc: Provides a module for testing the server while linked in a network */
18 class CommandTest : public Command
21 CommandTest(Module* parent) : Command(parent, "TEST", 1)
23 syntax = "<action> <parameters>";
26 CmdResult Handle(const std::vector<std::string> ¶meters, User *user)
28 if (parameters[0] == "flood")
30 unsigned int count = parameters.size() > 1 ? atoi(parameters[1].c_str()) : 100;
31 std::string line = parameters.size() > 2 ? parameters[2] : ":z.z NOTICE !flood :Flood text";
32 for(unsigned int i=0; i < count; i++)
35 else if (parameters[0] == "freeze" && IS_LOCAL(user))
37 IS_LOCAL(user)->Penalty += 100;
39 else if (parameters[0] == "shutdown")
41 int i = parameters.size() > 1 ? atoi(parameters[1].c_str()) : 2;
42 ServerInstance->SE->Shutdown(user->GetFd(), i);
48 class ModuleTest : public Module
52 ModuleTest() : cmd(this)
54 if (!strstr(ServerInstance->Config->ServerName.c_str(), ".test"))
55 throw ModuleException("Don't load modules without reading their descriptions!");
56 ServerInstance->AddCommand(&cmd);
61 return Version("Provides a module for testing the server while linked in a network", VF_VENDOR|VF_OPTCOMMON);
65 MODULE_INIT(ModuleTest)