1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
22 /** A test resolver class for IPV6
24 class MyV6Resolver : public Resolver
28 MyV6Resolver(InspIRCd* Instance, Module* me, const std::string &source, bool forward, bool &cached) : Resolver(Instance, source, forward ? DNS_QUERY_AAAA : DNS_QUERY_PTR6, cached, me)
33 virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
35 ServerInstance->Log(DEBUG,"*** RESOLVER COMPLETED %s LOOKUP, IP IS: '%s' TTL=%lu CACHED=%d",fw ? "FORWARD" : "REVERSE", result.c_str(), ttl, cached);
38 virtual void OnError(ResolverError e, const std::string &errormessage)
40 ServerInstance->Log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str());
46 class cmd_woot : public command_t
50 /* Command 'woot', takes no parameters and needs no special modes */
51 cmd_woot (InspIRCd* Instance, Module* maker) : command_t(Instance,"WOOT", 0, 0), Creator(maker)
53 this->source = "m_testcommand.so";
56 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
58 /* We dont have to worry about deleting 'r', the core will
59 * do it for us as required.*/
63 MyV6Resolver* r = new MyV6Resolver(ServerInstance, Creator, "shake.stacken.kth.se", true, cached);
64 ServerInstance->AddResolver(r, cached);
65 r = new MyV6Resolver(ServerInstance, Creator, "2001:6b0:1:ea:202:a5ff:fecd:13a6", false, cached);
66 ServerInstance->AddResolver(r, cached);
68 catch (ModuleException& e)
70 ServerInstance->Log(DEBUG,"Danger, will robinson! There was an exception: %s",e.GetReason());
77 class ModuleTestCommand : public Module
81 ModuleTestCommand(InspIRCd* Me)
85 // Create a new command
86 newcommand = new cmd_woot(ServerInstance, this);
87 ServerInstance->AddCommand(newcommand);
90 void Implements(char* List)
94 virtual ~ModuleTestCommand()
99 virtual Version GetVersion()
101 return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
105 MODULE_INIT(ModuleTestCommand);