7 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
12 void handle_woot(char **parameters, int pcnt, userrec *user)
14 // this test command just accepts:
16 // and sends <text> to all opers with +s mode.
17 // NB: The ':' is *REQUIRED* otherwise the parser will
18 // split the line into multiple parameters[]!
20 // If you want to process all the line with no leading colon, you must
21 // implement a parser here that assembles parameters[] to match the
22 // syntax of your command - the way it is done in the core is to meet
24 Srv->SendOpers(parameters[0]);
27 // Here is a sample of how to send servermodes. Note that unless remote
28 // servers in your net are u:lined, they may reverse this, but its a
29 // quick and effective modehack.
31 // NOTE: DO NOT CODE LIKE THIS!!! This has no checks and can send
32 // invalid or plain confusing mode changes, code some checking!
34 modes[0] = "#chatspike";
36 modes[2] = user->nick;
38 // run the mode change, send numerics (such as "no such channel") back
40 Srv->SendMode(modes,3,user);
43 class ModuleTestCommand : public Module
49 // Create a new command:
50 // command will be called /WOOT, and will
51 // call handle_woot when triggered, the
52 // 0 in the modes parameter signifies that
53 // anyone can issue the command, and the
54 // command takes only one parameter.
55 Srv->AddCommand("WOOT",handle_woot,0,1);
58 virtual ~ModuleTestCommand()
63 virtual Version GetVersion()
65 return Version(1,0,0,0);
68 virtual void OnUserConnect(userrec* user)
75 class ModuleTestCommandFactory : public ModuleFactory
78 ModuleTestCommandFactory()
82 ~ModuleTestCommandFactory()
86 virtual Module * CreateModule()
88 return new ModuleTestCommand;
94 extern "C" void * init_module( void )
96 return new ModuleTestCommandFactory;