summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-02 12:50:15 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-02 12:50:15 +0000
commit5797374a691d9436fdf713ef90fa537d09bc717c (patch)
tree1c30181434d80c1443257c160e4fd98d88a03096 /src/modules
parenta753fb1bc711e10794e939e424f3cdd703116d82 (diff)
Added simple test command module
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@352 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_testcommand.cpp69
1 files changed, 69 insertions, 0 deletions
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 <stdio.h>
+
+#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 <text>
+ // and sends <text> 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;
+}
+