From 2d821f2980825be73e3f90b47ffff365b0ec5ecb Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 7 Dec 2005 17:05:34 +0000 Subject: Changed behaviour of module API to pass Server* to the constructor, rather than have to create one (makes more sense) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2252 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_foobar.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/modules/m_foobar.cpp') diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index b2e56c94d..d08903e55 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -36,18 +36,16 @@ class ModuleFoobar : public Module Server *Srv; public: - ModuleFoobar() + ModuleFoobar(Server* Me) + : Module::Module(Me) { - // The constructor just creates an instance of the server class + // The constructor just makes a copy of the server class - Srv = new Server; + Srv = Me; } virtual ~ModuleFoobar() { - // destructor deletes the instance of the server class - - delete Srv; } virtual Version GetVersion() @@ -111,9 +109,9 @@ class ModuleFoobarFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleFoobar; + return new ModuleFoobar(Me); } }; -- cgit v1.2.3