diff options
-rw-r--r-- | include/modules.h | 18 | ||||
-rw-r--r-- | src/modules/m_alias.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_testcommand.cpp | 26 |
3 files changed, 19 insertions, 49 deletions
diff --git a/include/modules.h b/include/modules.h index b94abfbbc..332f2b812 100644 --- a/include/modules.h +++ b/include/modules.h @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -1608,4 +1608,20 @@ typedef std::vector<Module*> ModuleList; */ typedef std::vector<ircd_module*> FactoryList; + +#define MODULE_INIT(y) \ + class Factory : public ModuleFactory \ + { \ + public: \ + virtual Module * CreateModule(InspIRCd* Me) \ + { \ + return new y(Me); \ + } \ + }; \ + extern "C" DllExport void * init_module(void) \ + { \ + return new Factory; \ + } + #endif + diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 15a2928ee..1e117fb3d 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -269,27 +269,5 @@ class ModuleAlias : public Module } }; - -class ModuleAliasFactory : public ModuleFactory -{ - public: - ModuleAliasFactory() - { - } - - ~ModuleAliasFactory() - { - } - - virtual Module * CreateModule(InspIRCd* Me) - { - return new ModuleAlias(Me); - } -}; - - -extern "C" DllExport void * init_module( void ) -{ - return new ModuleAliasFactory; -} +MODULE_INIT(ModuleAlias); diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index a32559c68..c0fe10291 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -102,28 +102,4 @@ class ModuleTestCommand : public Module } }; - -class ModuleTestCommandFactory : public ModuleFactory -{ - public: - ModuleTestCommandFactory() - { - } - - ~ModuleTestCommandFactory() - { - } - - virtual Module * CreateModule(InspIRCd* Me) - { - return new ModuleTestCommand(Me); - } - -}; - - -extern "C" DllExport void * init_module( void ) -{ - return new ModuleTestCommandFactory; -} - +MODULE_INIT(ModuleTestCommand); |