]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_testcommand.cpp
kick_channel -> chanrec::KickUser(), server_kick_channel -> chanrec::ServerKickUser()
[user/henk/code/inspircd.git] / src / modules / m_testcommand.cpp
index 881024cc7b383624b28acb67e382bcdcb8c7c44c..6f517e8ced9c8582ae8a3a48b0ae57495c293a9e 100644 (file)
@@ -25,19 +25,23 @@ using namespace std;
 
 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
 
-class MyResolver : public Resolver
+class MyV6Resolver : public Resolver
 {
+       bool fw;
  public:
-       MyResolver(const std::string &source, bool forward, const std::string &dnsserver = "") : Resolver(source, forward, dnsserver) { }
+       MyV6Resolver(const std::string &source, bool forward) : Resolver(source, forward ? DNS_QUERY_AAAA : DNS_QUERY_PTR6)
+       {
+               fw = forward;
+       }
 
        virtual void OnLookupComplete(const std::string &result)
        {
-               log(DEBUG,"*** RESOLVER COMPLETED LOOKUP, IP IS: '%s'",result.c_str());
+               log(DEBUG,"*** RESOLVER COMPLETED %s LOOKUP, IP IS: '%s'",fw ? "FORWARD" : "REVERSE", result.c_str());
        }
 
-       virtual void OnError(ResolverError e)
+       virtual void OnError(ResolverError e, const std::string &errormessage)
        {
-               log(DEBUG,"*** RESOLVER GOT ERROR: %d",e);
+               log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str());
        }
 };
 
@@ -51,14 +55,16 @@ class cmd_woot : public command_t
                this->source = "m_testcommand.so";
        }
 
-       void Handle (char **parameters, int pcnt, userrec *user)
+       void Handle (const char** parameters, int pcnt, userrec *user)
        {
                /* We dont have to worry about deleting 'r', the core will
                 * do it for us as required.*/
 
                try
                {
-                       MyResolver* r = new MyResolver("brainbox.ath.cx", true);
+                       MyV6Resolver* r = new MyV6Resolver("shake.stacken.kth.se", true);
+                       Srv->AddResolver(r);
+                       r = new MyV6Resolver("2001:6b0:1:ea:202:a5ff:fecd:13a6", false);
                        Srv->AddResolver(r);
                }
                catch (ModuleException& e)