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 * ---------------------------------------------------
23 #include "helperfuncs.h"
26 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
28 class MyResolver : public Resolver
31 MyResolver(const std::string &source, bool forward, const std::string &dnsserver = "") : Resolver(source, forward, dnsserver) { }
33 virtual void OnLookupComplete(const std::string &result)
35 log(DEBUG,"*** RESOLVER COMPLETED LOOKUP, IP IS: '%s'",result.c_str());
38 virtual void OnError(ResolverError e)
40 log(DEBUG,"*** RESOLVER GOT ERROR: %d",e);
46 class cmd_woot : public command_t
49 cmd_woot () : command_t("WOOT", 0, 0)
51 this->source = "m_testcommand.so";
54 void Handle (char **parameters, int pcnt, userrec *user)
56 /* We dont have to worry about deleting 'r', the core will
57 * do it for us as required.*/
58 MyResolver* r = new MyResolver("brainbox.ath.cx", true);
63 class ModuleTestCommand : public Module
67 ModuleTestCommand(Server* Me)
71 // Create a new command:
72 // command will be called /WOOT, and will
73 // call handle_woot when triggered, the
74 // 0 in the modes parameter signifies that
75 // anyone can issue the command, and the
76 // command takes only one parameter.
77 newcommand = new cmd_woot();
78 Srv->AddCommand(newcommand);
81 void Implements(char* List)
83 List[I_OnUserJoin] = 1;
86 virtual void OnUserJoin(userrec* user, chanrec* channel)
90 virtual ~ModuleTestCommand()
94 virtual Version GetVersion()
96 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
101 class ModuleTestCommandFactory : public ModuleFactory
104 ModuleTestCommandFactory()
108 ~ModuleTestCommandFactory()
112 virtual Module * CreateModule(Server* Me)
114 return new ModuleTestCommand(Me);
120 extern "C" void * init_module( void )
122 return new ModuleTestCommandFactory;