]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_knock.cpp
Fix for bug #415, affects only trunk (wish i'd known this before i started!)
[user/henk/code/inspircd.git] / src / modules / m_knock.cpp
index 075064554f09e0d3b8d43990fdb197cc9a104b6a..5ed69273e2d4e82e42a69c5cd92e6585f324a626 100644 (file)
@@ -12,9 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 
 /* $ModDesc: Provides support for /KNOCK and mode +K */
 
@@ -27,6 +24,7 @@ class cmd_knock : public command_t
        {
                this->source = "m_knock.so";
                syntax = "<channel> <reason>";
+               TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
        }
        
        CmdResult Handle (const char** parameters, int pcnt, userrec *user)
@@ -102,10 +100,11 @@ class ModuleKnock : public Module
  public:
        ModuleKnock(InspIRCd* Me) : Module(Me)
        {
-               
                kn = new Knock(ServerInstance);
+
                if (!ServerInstance->AddMode(kn, 'K'))
                        throw ModuleException("Could not add new modes!");
+
                mycommand = new cmd_knock(ServerInstance);
                ServerInstance->AddCommand(mycommand);
        }
@@ -117,38 +116,13 @@ class ModuleKnock : public Module
        virtual ~ModuleKnock()
        {
                ServerInstance->Modes->DelMode(kn);
-               DELETE(kn);
+               delete kn;
        }
 
        virtual Version GetVersion()
        {
-               return Version(1,1,0,1,VF_COMMON|VF_VENDOR,API_VERSION);
+               return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };
 
-// stuff down here is the module-factory stuff. For basic modules you can ignore this.
-
-class ModuleKnockFactory : public ModuleFactory
-{
- public:
-       ModuleKnockFactory()
-       {
-       }
-       
-       ~ModuleKnockFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleKnock(Me);
-       }
-       
-};
-
-
-extern "C" DllExport void * init_module( void )
-{
-       return new ModuleKnockFactory;
-}
-
+MODULE_INIT(ModuleKnock)