1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
24 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
28 class cmd_woot : public command_t
31 cmd_woot () : command_t("WOOT", 0, 0)
33 this->source = "m_testcommand.so";
36 void Handle (char **parameters, int pcnt, userrec *user)
38 Srv->Log(DEBUG,"woot handler");
39 // Here is a sample of how to send servermodes. Note that unless remote
40 // servers in your net are u:lined, they may reverse this, but its a
41 // quick and effective modehack.
43 // NOTE: DO NOT CODE LIKE THIS!!! This has no checks and can send
44 // invalid or plain confusing mode changes, code some checking!
46 modes[0] = "#chatspike";
48 modes[2] = user->nick;
50 // run the mode change, send numerics (such as "no such channel") back
52 Srv->SendMode(modes,3,user);
56 class ModuleTestCommand : public Module
60 ModuleTestCommand(Server* Me)
64 // Create a new command:
65 // command will be called /WOOT, and will
66 // call handle_woot when triggered, the
67 // 0 in the modes parameter signifies that
68 // anyone can issue the command, and the
69 // command takes only one parameter.
70 newcommand = new cmd_woot();
71 Srv->AddCommand(newcommand);
74 void Implements(char* List)
76 List[I_OnUserJoin] = 1;
79 virtual void OnUserJoin(userrec* user, chanrec* channel)
83 virtual ~ModuleTestCommand()
87 virtual Version GetVersion()
89 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
94 class ModuleTestCommandFactory : public ModuleFactory
97 ModuleTestCommandFactory()
101 ~ModuleTestCommandFactory()
105 virtual Module * CreateModule(Server* Me)
107 return new ModuleTestCommand(Me);
113 extern "C" void * init_module( void )
115 return new ModuleTestCommandFactory;