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 * ---------------------------------------------------
25 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
27 class MyResolver : public Resolver
29 MyResolver(const std::string &source, bool forward, const std::string &dnsserver = "") : Resolver(source, forward, dnsserver) { }
31 virtual void OnLookupComplete(const std::string &result)
33 log(DEBUG,"*** RESOLVER COMPLETED LOOKUP, IP IS: '%s'",result.c_str());
36 virtual void OnError(ResolverError e)
38 log(DEBUG,"*** RESOLVER GOT ERROR: %d",e);
44 class cmd_woot : public command_t
47 cmd_woot () : command_t("WOOT", 0, 0)
49 this->source = "m_testcommand.so";
52 void Handle (char **parameters, int pcnt, userrec *user)
54 /* We dont have to worry about deleting 'r', the core will
55 * do it for us as required.*/
56 MyResolver* r = new MyResolver("brainbox.ath.cx", true);
61 class ModuleTestCommand : public Module
65 ModuleTestCommand(Server* Me)
69 // Create a new command:
70 // command will be called /WOOT, and will
71 // call handle_woot when triggered, the
72 // 0 in the modes parameter signifies that
73 // anyone can issue the command, and the
74 // command takes only one parameter.
75 newcommand = new cmd_woot();
76 Srv->AddCommand(newcommand);
79 void Implements(char* List)
81 List[I_OnUserJoin] = 1;
84 virtual void OnUserJoin(userrec* user, chanrec* channel)
88 virtual ~ModuleTestCommand()
92 virtual Version GetVersion()
94 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
99 class ModuleTestCommandFactory : public ModuleFactory
102 ModuleTestCommandFactory()
106 ~ModuleTestCommandFactory()
110 virtual Module * CreateModule(Server* Me)
112 return new ModuleTestCommand(Me);
118 extern "C" void * init_module( void )
120 return new ModuleTestCommandFactory;