From 5797374a691d9436fdf713ef90fa537d09bc717c Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 2 Apr 2004 12:50:15 +0000 Subject: Added simple test command module git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@352 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_testcommand.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/modules/m_testcommand.cpp (limited to 'src/modules') diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp new file mode 100644 index 000000000..fd05b8009 --- /dev/null +++ b/src/modules/m_testcommand.cpp @@ -0,0 +1,69 @@ +#include + +#include "users.h" +#include "channels.h" +#include "modules.h" + +/* $ModDesc: Povides a proof-of-concept test /WOOT command */ + +Server *Srv; + + +void handle_woot(char **parameters, int pcnt, userrec *user) +{ + // this test command just accepts: + // /woot + // and sends to all opers with +s mode. + Srv->SendOpers(parameters[0]); +} + +class ModuleTestCommand : public Module +{ + public: + ModuleTestCommand() + { + Srv = new Server; + Srv->AddCommand("WOOT",handle_woot,0,1) + } + + virtual ~ModuleTestCommand() + { + delete Srv; + } + + virtual Version GetVersion() + { + return Version(1,0,0,0); + } + + virtual void OnUserConnect(userrec* user) + { + } + +}; + + +class ModuleTestCommandFactory : public ModuleFactory +{ + public: + ModuleTestCommandFactory() + { + } + + ~ModuleTestCommandFactory() + { + } + + virtual Module * CreateModule() + { + return new ModuleTestCommand; + } + +}; + + +extern "C" void * init_module( void ) +{ + return new ModuleTestCommandFactory; +} + -- cgit v1.2.3