]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_testcommand.cpp
Made SANICK not collide the user (theres no need to in the new 1.1 now we have return...
[user/henk/code/inspircd.git] / src / modules / m_testcommand.cpp
index ffa79f2cd9a6eccf5857f072f03f01b7114db123..bc268c34b86307bf965552ba4d138ac72d0fc9dd 100644 (file)
@@ -20,13 +20,13 @@ using namespace std;
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-#include "helperfuncs.h"
+
 #include "dns.h"
 #include "inspircd.h"
 
 /* $ModDesc: Povides a proof-of-concept test /WOOT command */
 
-extern InspIRCd* ServerInstance;
+
 
 class MyV6Resolver : public Resolver
 {
@@ -39,26 +39,26 @@ class MyV6Resolver : public Resolver
 
        virtual void OnLookupComplete(const std::string &result)
        {
-               log(DEBUG,"*** RESOLVER COMPLETED %s LOOKUP, IP IS: '%s'",fw ? "FORWARD" : "REVERSE", result.c_str());
+               ServerInstance->Log(DEBUG,"*** RESOLVER COMPLETED %s LOOKUP, IP IS: '%s'",fw ? "FORWARD" : "REVERSE", result.c_str());
        }
 
        virtual void OnError(ResolverError e, const std::string &errormessage)
        {
-               log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str());
+               ServerInstance->Log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str());
        }
 };
 
-static Server *Srv;
+
         
 class cmd_woot : public command_t
 {
  public:
-       cmd_woot () : command_t("WOOT", 0, 0)
+       cmd_woot (InspIRCd* Instance) : command_t(Instance,"WOOT", 0, 0)
        {
                this->source = "m_testcommand.so";
        }
 
-       void Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult 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.*/
@@ -66,14 +66,16 @@ class cmd_woot : public command_t
                try
                {
                        MyV6Resolver* r = new MyV6Resolver("shake.stacken.kth.se", true);
-                       Srv->AddResolver(r);
+                       ServerInstance->AddResolver(r);
                        r = new MyV6Resolver("2001:6b0:1:ea:202:a5ff:fecd:13a6", false);
-                       Srv->AddResolver(r);
+                       ServerInstance->AddResolver(r);
                }
                catch (ModuleException& e)
                {
-                       log(DEBUG,"Danger, will robinson! There was an exception: %s",e.GetReason());
+                       ServerInstance->Log(DEBUG,"Danger, will robinson! There was an exception: %s",e.GetReason());
                }
+
+               return CMD_FAILURE;
        }
 };
 
@@ -91,8 +93,8 @@ class ModuleTestCommand : public Module
                // 0 in the modes parameter signifies that
                // anyone can issue the command, and the
                // command takes only one parameter.
-               newcommand = new cmd_woot();
-               Srv->AddCommand(newcommand);
+               newcommand = new cmd_woot(ServerInstance);
+               ServerInstance->AddCommand(newcommand);
        }
 
        void Implements(char* List)
@@ -110,7 +112,7 @@ class ModuleTestCommand : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
+               return Version(1, 0, 0, 0, VF_VENDOR);
        }
 };