diff options
Diffstat (limited to 'src/modules')
59 files changed, 309 insertions, 325 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index 89e8fe2de..0e36115b9 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -41,14 +41,15 @@ class ModuleFilterPCRE : public Module int erroffset; public: - ModuleFilterPCRE() + ModuleFilterPCRE(Server* Me) + : Module::Module(Me) { // read the configuration file on startup. - // it is perfectly valid to set <FilterPCRE file> to the value of the + // it is perfectly valid to set <filter file> to the value of the // main config file, then append your <keyword> tags to the bottom // of the main config... but rather messy. That's why the capability // of using a seperate config file is provided. - Srv = new Server; + Srv = Me; Conf = new ConfigReader; std::string filterfile = Conf->ReadValue("filter","file",0); MyConf = new ConfigReader(filterfile); @@ -81,7 +82,6 @@ class ModuleFilterPCRE : public Module virtual ~ModuleFilterPCRE() { - delete Srv; delete MyConf; delete Conf; } @@ -239,9 +239,9 @@ class ModuleFilterPCREFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleFilterPCRE; + return new ModuleFilterPCRE(Me); } }; diff --git a/src/modules/extra/m_sql.cpp b/src/modules/extra/m_sql.cpp index f1d95cf9f..7038707f8 100644 --- a/src/modules/extra/m_sql.cpp +++ b/src/modules/extra/m_sql.cpp @@ -311,9 +311,10 @@ class ModuleSQL : public Module return NULL; } - ModuleSQL() + ModuleSQL(Server* Me) + : Module::Module(Me) { - Srv = new Server(); + Srv = Me; Conf = new ConfigReader(); LoadDatabases(Conf); } @@ -322,7 +323,6 @@ class ModuleSQL : public Module { Connections.clear(); delete Conf; - delete Srv; } virtual void OnRehash(std::string parameter) @@ -352,9 +352,9 @@ class ModuleSQLFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSQL; + return new ModuleSQL(Me); } }; diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index e1c0929c4..1faf2c0d7 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -72,9 +72,10 @@ class ModuleSQLAuth : public Module return (SQLModule); } - ModuleSQLAuth() + ModuleSQLAuth(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; ReadConfig(); } @@ -170,7 +171,6 @@ class ModuleSQLAuth : public Module virtual ~ModuleSQLAuth() { - delete Srv; } virtual Version GetVersion() @@ -191,9 +191,9 @@ class ModuleSQLAuthFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSQLAuth; + return new ModuleSQLAuth(Me); } }; diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index f80fec80b..badc67731 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -65,9 +65,10 @@ class ModuleSQLLog : public Module return (SQLModule); } - ModuleSQLLog() + ModuleSQLLog(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; ReadConfig(); } @@ -237,7 +238,6 @@ class ModuleSQLLog : public Module virtual ~ModuleSQLLog() { - delete Srv; } virtual Version GetVersion() @@ -258,9 +258,9 @@ class ModuleSQLLogFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSQLLog; + return new ModuleSQLLog(Me); } }; diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 630e3520a..369815f6d 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -55,9 +55,10 @@ class ModuleSQLOper : public Module return (SQLModule); } - ModuleSQLOper() + ModuleSQLOper(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Conf = new ConfigReader(); ReadConfig(); } @@ -193,7 +194,6 @@ class ModuleSQLOper : public Module virtual ~ModuleSQLOper() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -214,9 +214,9 @@ class ModuleSQLOperFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSQLOper; + return new ModuleSQLOper(Me); } }; diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 6eda35f13..e0c202eed 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -63,17 +63,16 @@ class ModuleAlias : public Module public: - ModuleAlias() + ModuleAlias(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; MyConf = new ConfigReader; - ReadAliases(); } virtual ~ModuleAlias() { - delete Srv; delete MyConf; } @@ -156,9 +155,9 @@ class ModuleAliasFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleAlias; + return new ModuleAlias(Me); } }; diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index 8c456bdfb..8b11c80c5 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -27,14 +27,14 @@ class ModuleAntiBottler : public Module Server *Srv; public: - ModuleAntiBottler() + ModuleAntiBottler(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; } virtual ~ModuleAntiBottler() { - delete Srv; } virtual Version GetVersion() @@ -102,9 +102,9 @@ class ModuleAntiBottlerFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleAntiBottler; + return new ModuleAntiBottler(Me); } }; diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 13663cc40..f63caf6c5 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -30,9 +30,10 @@ class ModuleBlockColor : public Module Server *Srv; public: - ModuleBlockColor() + ModuleBlockColor(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('c',MT_CHANNEL,false,0,0); } @@ -110,7 +111,6 @@ class ModuleBlockColor : public Module virtual ~ModuleBlockColor() { - delete Srv; } virtual Version GetVersion() @@ -131,9 +131,9 @@ class ModuleBlockColorFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleBlockColor; + return new ModuleBlockColor(Me); } }; diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 015677536..d8d0a8f29 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -28,9 +28,10 @@ class ModuleBotMode : public Module { Server *Srv; public: - ModuleBotMode() + ModuleBotMode(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; if (!Srv->AddExtendedMode('B',MT_CLIENT,false,0,0)) { @@ -42,7 +43,6 @@ class ModuleBotMode : public Module virtual ~ModuleBotMode() { - delete Srv; } virtual Version GetVersion() @@ -85,9 +85,9 @@ class ModuleBotModeFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleBotMode; + return new ModuleBotMode(Me); } }; diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 94dbec852..e396a3e51 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -31,14 +31,15 @@ class ModuleCensor : public Module ConfigReader *Conf, *MyConf; public: - ModuleCensor() + ModuleCensor(Server* Me) + : Module::Module(Me) { // read the configuration file on startup. // it is perfectly valid to set <censor file> to the value of the // main config file, then append your <badword> tags to the bottom // of the main config... but rather messy. That's why the capability // of using a seperate config file is provided. - Srv = new Server; + Srv = Me; Conf = new ConfigReader; std::string Censorfile = Conf->ReadValue("censor","file",0); MyConf = new ConfigReader(Censorfile); @@ -88,7 +89,6 @@ class ModuleCensor : public Module virtual ~ModuleCensor() { - delete Srv; delete MyConf; delete Conf; } @@ -208,9 +208,9 @@ class ModuleCensorFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleCensor; + return new ModuleCensor(Me); } }; diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 48b81cc8f..fc9cac2e0 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -36,9 +36,10 @@ class ModuleChanFilter : public Module public: - ModuleChanFilter() + ModuleChanFilter(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Conf = new ConfigReader; Srv->AddExtendedListMode('g'); MaxEntries = Conf->ReadInteger("chanfilter","maxsize",0,true); @@ -202,7 +203,6 @@ class ModuleChanFilter : public Module virtual ~ModuleChanFilter() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -237,9 +237,9 @@ class ModuleChanFilterFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleChanFilter; + return new ModuleChanFilter(Me); } }; diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index a9764f72e..25ff6b12a 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -34,13 +34,14 @@ class ModuleChanProtect : public Module public: - ModuleChanProtect() + ModuleChanProtect(Server* Me) + : Module::Module(Me) { // here we initialise our module. Use new to create new instances of the required // classes. - Srv = new Server; + Srv = Me; Conf = new ConfigReader; // set up our modes. We're using listmodes and not normal extmodes here. @@ -327,7 +328,6 @@ class ModuleChanProtect : public Module virtual ~ModuleChanProtect() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -369,9 +369,9 @@ class ModuleChanProtectFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleChanProtect; + return new ModuleChanProtect(Me); } }; diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index f786a9f30..498d8e7a4 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -50,15 +50,15 @@ void handle_chghost(char **parameters, int pcnt, userrec *user) class ModuleChgHost : public Module { public: - ModuleChgHost() + ModuleChgHost(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("CHGHOST",handle_chghost,'o',2,"m_chghost.so"); } virtual ~ModuleChgHost() { - delete Srv; } virtual Version GetVersion() @@ -81,9 +81,9 @@ class ModuleChgHostFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleChgHost; + return new ModuleChgHost(Me); } }; diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 44a03a39b..d7f4082ee 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -268,10 +268,11 @@ class ModuleCloaking : public Module } public: - ModuleCloaking() + ModuleCloaking(Server* Me) + : Module::Module(Me) { - // We must create an instance of the Server class to work with - Srv = new Server; + // We must take a copy of the Server class to work with + Srv = Me; // we must create a new mode. Set the parameters so the // mode doesn't require oper, and is a client usermode @@ -291,8 +292,6 @@ class ModuleCloaking : public Module virtual ~ModuleCloaking() { - // not really neccessary, but free it anyway - delete Srv; } virtual Version GetVersion() @@ -401,9 +400,9 @@ class ModuleCloakingFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleCloaking; + return new ModuleCloaking(Me); } }; diff --git a/src/modules/m_conn_lusers.cpp b/src/modules/m_conn_lusers.cpp index 779d14576..8a468c96a 100644 --- a/src/modules/m_conn_lusers.cpp +++ b/src/modules/m_conn_lusers.cpp @@ -32,14 +32,14 @@ class ModuleConnLUSERS : public Module Server *Srv; public: - ModuleConnLUSERS() + ModuleConnLUSERS(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; } virtual ~ModuleConnLUSERS() { - delete Srv; } virtual Version GetVersion() @@ -84,9 +84,9 @@ class ModuleConnLUSERSFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleConnLUSERS; + return new ModuleConnLUSERS(Me); } }; diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 154141d6d..ab0c3616f 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -33,16 +33,16 @@ class ModuleDenyChannels : public Module ConfigReader *Conf; public: - ModuleDenyChannels() + ModuleDenyChannels(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Conf = new ConfigReader; } virtual ~ModuleDenyChannels() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -87,9 +87,9 @@ class ModuleDenyChannelsFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleDenyChannels; + return new ModuleDenyChannels(Me); } }; diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index fc4272e3d..967b78023 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -35,14 +35,15 @@ class ModuleFilter : public Module ConfigReader *Conf, *MyConf; public: - ModuleFilter() + ModuleFilter(Server* Me) + : Module::Module(Me) { // read the configuration file on startup. // it is perfectly valid to set <filter file> to the value of the // main config file, then append your <keyword> tags to the bottom // of the main config... but rather messy. That's why the capability // of using a seperate config file is provided. - Srv = new Server; + Srv = Me; Conf = new ConfigReader; std::string filterfile = Conf->ReadValue("filter","file",0); MyConf = new ConfigReader(filterfile); @@ -57,7 +58,6 @@ class ModuleFilter : public Module virtual ~ModuleFilter() { - delete Srv; delete MyConf; delete Conf; } @@ -201,9 +201,9 @@ class ModuleFilterFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleFilter; + return new ModuleFilter(Me); } }; 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); } }; diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 112a375dd..48b406dcb 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -42,9 +42,10 @@ void handle_globops(char **parameters, int pcnt, userrec *user) class ModuleGlobops : public Module { public: - ModuleGlobops() + ModuleGlobops(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; if (!Srv->AddExtendedMode('g',MT_CLIENT,true,0,0)) { @@ -57,7 +58,6 @@ class ModuleGlobops : public Module virtual ~ModuleGlobops() { - delete Srv; } virtual Version GetVersion() @@ -95,9 +95,9 @@ class ModuleGlobopsFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleGlobops; + return new ModuleGlobops(Me); } }; diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 6681d8f66..2a0a0e62b 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -158,9 +158,10 @@ class ModuleHelpop : public Module std::string h_file; public: - ModuleHelpop() + ModuleHelpop(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; ReadConfig(); if (!Srv->AddExtendedMode('h',MT_CLIENT,true,0,0)) @@ -223,7 +224,6 @@ class ModuleHelpop : public Module virtual ~ModuleHelpop() { - delete Srv; delete conf; delete helpop; } @@ -245,9 +245,9 @@ class ModuleHelpopFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleHelpop; + return new ModuleHelpop(Me); } }; diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 7bf19313f..7fb14a1ba 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -32,18 +32,16 @@ class ModuleHostChange : public Module std::string MySuffix; public: - ModuleHostChange() + ModuleHostChange(Server* Me) + : Module::Module(Me) { - // We must create an instance of the Server class to work with - Srv = new Server; + Srv = Me; Conf = new ConfigReader; MySuffix = Conf->ReadValue("host","suffix",0); } virtual ~ModuleHostChange() { - // not really neccessary, but free it anyway - delete Srv; delete Conf; } @@ -122,9 +120,9 @@ class ModuleHostChangeFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleHostChange; + return new ModuleHostChange(Me); } }; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index a46d931d8..c55c51499 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -263,9 +263,10 @@ class ModuleIdent : public Module delete Conf; } - ModuleIdent() + ModuleIdent(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; ReadSettings(); } @@ -334,7 +335,6 @@ class ModuleIdent : public Module virtual ~ModuleIdent() { - delete Srv; } virtual Version GetVersion() @@ -355,9 +355,9 @@ class ModuleIdentFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleIdent; + return new ModuleIdent(Me); } }; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 171e7045a..08ce7ece4 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -60,9 +60,10 @@ void handle_knock(char **parameters, int pcnt, userrec *user) class ModuleKnock : public Module { public: - ModuleKnock() + ModuleKnock(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('K',MT_CHANNEL,false,0,0); Srv->AddCommand("KNOCK",handle_knock,0,2,"m_knock.so"); @@ -92,7 +93,6 @@ class ModuleKnock : public Module virtual ~ModuleKnock() { - delete Srv; } virtual Version GetVersion() @@ -128,9 +128,9 @@ class ModuleKnockFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleKnock; + return new ModuleKnock(Me); } }; diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index a2d365c3a..efdfcca4d 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -79,9 +79,10 @@ void handle_nickunlock(char **parameters, int pcnt, userrec *user) class ModuleNickLock : public Module { public: - ModuleNickLock() + ModuleNickLock(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("NICKLOCK",handle_nicklock,'o',2,"m_nicklock.so"); Srv->AddCommand("NICKUNLOCK",handle_nickunlock,'o',1,"m_nicklock.so"); } @@ -125,9 +126,9 @@ class ModuleNickLockFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleNickLock; + return new ModuleNickLock(Me); } }; diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 72fb4858c..2dd249559 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -30,9 +30,10 @@ class ModuleNoCTCP : public Module public: - ModuleNoCTCP() + ModuleNoCTCP(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('C',MT_CHANNEL,false,0,0); } @@ -111,7 +112,6 @@ class ModuleNoCTCP : public Module virtual ~ModuleNoCTCP() { - delete Srv; } virtual Version GetVersion() @@ -132,9 +132,9 @@ class ModuleNoCTCPFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleNoCTCP; + return new ModuleNoCTCP(Me); } }; diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index 313d8eefa..476dbea1e 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -3,13 +3,13 @@ * +------------------------------------+ * * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. - * E-mail: - *<brain@chatspike.net> - * <Craig@chatspike.net> + * E-mail: + * <brain@chatspike.net> + * <Craig@chatspike.net> * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see - *the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -30,9 +30,10 @@ class ModuleNoInvite : public Module public: - ModuleNoInvite() + ModuleNoInvite(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('V',MT_CHANNEL,false,0,0); } @@ -82,7 +83,6 @@ class ModuleNoInvite : public Module virtual ~ModuleNoInvite() { - delete Srv; } virtual Version GetVersion() @@ -103,9 +103,9 @@ class ModuleNoInviteFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleNoInvite; + return new ModuleNoInvite(Me); } }; diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index cade4f340..6c164f03a 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -30,9 +30,10 @@ class ModuleNoKicks : public Module public: - ModuleNoKicks() + ModuleNoKicks(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('Q',MT_CHANNEL,false,0,0); } @@ -92,7 +93,6 @@ class ModuleNoKicks : public Module virtual ~ModuleNoKicks() { - delete Srv; } virtual Version GetVersion() @@ -113,9 +113,9 @@ class ModuleNoKicksFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleNoKicks; + return new ModuleNoKicks(Me); } }; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 1f44bfef6..6c0a0163d 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -26,21 +26,21 @@ using namespace std; /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */ -Server *Srv; - class ModuleNoNickChange : public Module { + Server *Srv; + public: - ModuleNoNickChange() + ModuleNoNickChange(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('N',MT_CHANNEL,false,0,0); } virtual ~ModuleNoNickChange() { - delete Srv; } virtual Version GetVersion() @@ -122,9 +122,9 @@ class ModuleNoNickChangeFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleNoNickChange; + return new ModuleNoNickChange(Me); } }; diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 563b94b12..ceb659985 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -29,9 +29,10 @@ class ModuleNoNotice : public Module Server *Srv; public: - ModuleNoNotice() + ModuleNoNotice(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('T',MT_CHANNEL,false,0,0); } @@ -91,7 +92,6 @@ class ModuleNoNotice : public Module virtual ~ModuleNoNotice() { - delete Srv; } virtual Version GetVersion() @@ -112,9 +112,9 @@ class ModuleNoNoticeFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleNoNotice; + return new ModuleNoNotice(Me); } }; diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index bd3d750bd..db2c24671 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -30,10 +30,10 @@ Server *Srv; class ModuleOperChans : public Module { public: - ModuleOperChans() + ModuleOperChans(Server* Me) + : Module::Module(Me) { - Srv = new Server; - + Srv = Me; // Add a mode +O for channels with no parameters Srv->AddExtendedMode('O',MT_CHANNEL,false,0,0); } @@ -99,18 +99,12 @@ class ModuleOperChans : public Module virtual ~ModuleOperChans() { - delete Srv; } virtual Version GetVersion() { return Version(1,0,0,0,VF_STATIC|VF_VENDOR); } - - virtual void OnUserConnect(userrec* user) - { - } - }; @@ -125,9 +119,9 @@ class ModuleOperChansFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleOperChans; + return new ModuleOperChans(Me); } }; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index d1d9ef3b0..b9adb890c 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -9,25 +9,24 @@ using namespace std; /* $ModDesc: Forces opers to join a specified channel on oper-up */ -Server *Srv; - class ModuleOperjoin : public Module { private: std::string operChan; ConfigReader* conf; + Server* Srv; public: - ModuleOperjoin() + ModuleOperjoin(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; conf = new ConfigReader; operChan = conf->ReadValue("operjoin", "channel", 0); } virtual ~ModuleOperjoin() { - delete Srv; delete conf; } @@ -58,9 +57,9 @@ class ModuleOperjoinFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleOperjoin; + return new ModuleOperjoin(Me); } }; diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index b51655592..54d111440 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -19,16 +19,16 @@ class ModuleOperLevels : public Module public: - ModuleOperLevels() + ModuleOperLevels(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; conf = new ConfigReader; } virtual ~ModuleOperLevels() { - delete Srv; delete conf; } @@ -91,9 +91,9 @@ class ModuleOperLevelsFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleOperLevels; + return new ModuleOperLevels(Me); } }; diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index 4a4fff756..6ce0cab2f 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -272,15 +272,15 @@ class ModuleOperMD5 : public Module { public: - ModuleOperMD5() + ModuleOperMD5(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("MKPASSWD",handle_mkpasswd,'o',1,"m_opermd5.so"); } virtual ~ModuleOperMD5() { - delete Srv; } virtual int OnOperCompare(std::string data, std::string input) @@ -321,9 +321,9 @@ class ModuleOperMD5Factory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleOperMD5; + return new ModuleOperMD5(Me); } }; diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 7bfc67f6b..a2229a047 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -31,16 +31,16 @@ class ModuleModesOnOper : public Module ConfigReader *Conf; public: - ModuleModesOnOper() + ModuleModesOnOper(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Conf = new ConfigReader; } virtual ~ModuleModesOnOper() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -85,9 +85,9 @@ class ModuleModesOnOperFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleModesOnOper; + return new ModuleModesOnOper(Me); } }; diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 2c4a44925..a2a3c0312 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -17,14 +17,13 @@ void do_opermotd(char** parameters, int pcnt, userrec* user); void LoadOperMOTD() { - ConfigReader* conf = new ConfigReader; std::string filename; filename = conf->ReadValue("opermotd","file",0); opermotd->LoadFile(filename); - + delete conf; } void ShowOperMOTD(userrec* user) @@ -54,9 +53,10 @@ void do_opermotd(char** parameters, int pcnt, userrec* user) class ModuleOpermotd : public Module { public: - ModuleOpermotd() + ModuleOpermotd(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("OPERMOTD",do_opermotd,'o',0,"m_opermotd.so"); opermotd = new FileReader(); @@ -65,7 +65,6 @@ class ModuleOpermotd : public Module virtual ~ModuleOpermotd() { - delete Srv; } virtual Version GetVersion() @@ -96,9 +95,9 @@ class ModuleOpermotdFactory : public ModuleFactory { } - virtual Module* CreateModule() + virtual Module* CreateModule(Server* Me) { - return new ModuleOpermotd; + return new ModuleOpermotd(Me); } }; diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index ed01288a3..5bd453597 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -24,8 +24,6 @@ using namespace std; /* $ModDesc: Provides support for unreal-style oper-override */ -char dummyvalue[] = "on"; - class ModuleOverride : public Module { Server *Srv; @@ -34,13 +32,14 @@ class ModuleOverride : public Module public: - ModuleOverride() + ModuleOverride(Server* Me) + : Module::Module(Me) { // here we initialise our module. Use new to create new instances of the required // classes. - Srv = new Server; + Srv = Me; Conf = new ConfigReader; // read our config options (main config file) @@ -208,7 +207,6 @@ class ModuleOverride : public Module virtual ~ModuleOverride() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -229,9 +227,9 @@ class ModuleOverrideFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleOverride; + return new ModuleOverride(Me); } }; diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index e46a8f1b4..716c91579 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -184,9 +184,10 @@ class ModulePark : public Module delete Conf; } - ModulePark() + ModulePark(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; pinfo.clear(); this->ReadSettings(); Srv->AddCommand("PARK",handle_park,0,0,"m_park.so"); @@ -196,7 +197,6 @@ class ModulePark : public Module virtual ~ModulePark() { - delete Srv; } virtual void OnRehash(std::string parameter) @@ -320,9 +320,9 @@ class ModuleParkFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModulePark; + return new ModulePark(Me); } }; diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 71d54ce63..f75d3f1aa 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -24,7 +24,7 @@ using namespace std; #include "modules.h" #include "helperfuncs.h" -Server *Srv = NULL; +Server *Srv; FileReader *quotes = NULL; std::string q_file = ""; @@ -62,9 +62,10 @@ class ModuleRandQuote : public Module ConfigReader *conf; public: - ModuleRandQuote() + ModuleRandQuote(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; conf = new ConfigReader; // Sort the Randomizer thingie.. srand(time(NULL)); @@ -91,7 +92,6 @@ class ModuleRandQuote : public Module virtual ~ModuleRandQuote() { - delete Srv; delete conf; delete quotes; } @@ -123,9 +123,9 @@ class ModuleRandQuoteFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleRandQuote; + return new ModuleRandQuote(Me); } }; diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 2433896a8..28c092306 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -31,9 +31,10 @@ class ModuleRedirect : public Module public: - ModuleRedirect() + ModuleRedirect(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('L',MT_CHANNEL,false,1,0); } @@ -99,7 +100,6 @@ class ModuleRedirect : public Module virtual ~ModuleRedirect() { - delete Srv; } virtual Version GetVersion() @@ -125,9 +125,9 @@ class ModuleRedirectFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleRedirect; + return new ModuleRedirect(Me); } }; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index a3aafdab0..a72b41da0 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -113,9 +113,10 @@ void handle_remove(char **parameters, int pcnt, userrec *user) class ModuleRemove : public Module { public: - ModuleRemove() + ModuleRemove(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("REMOVE", handle_remove, 0, 3, "m_remove.so"); } @@ -126,7 +127,6 @@ class ModuleRemove : public Module virtual ~ModuleRemove() { - delete Srv; } virtual Version GetVersion() @@ -149,9 +149,9 @@ class ModuleRemoveFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleRemove; + return new ModuleRemove(Me); } }; diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index d06223d4e..77ab094b6 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -29,9 +29,10 @@ Server *Srv; class ModuleRestrictChans : public Module { public: - ModuleRestrictChans() + ModuleRestrictChans(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; } virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) @@ -51,7 +52,6 @@ class ModuleRestrictChans : public Module virtual ~ModuleRestrictChans() { - delete Srv; } virtual Version GetVersion() @@ -72,9 +72,9 @@ class ModuleRestrictChansFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleRestrictChans; + return new ModuleRestrictChans(Me); } }; diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index d73b4047d..5043b3f8d 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -32,9 +32,10 @@ class ModuleRestrictMsg : public Module Server *Srv; public: - ModuleRestrictMsg() + ModuleRestrictMsg(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; } virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text) @@ -65,7 +66,6 @@ class ModuleRestrictMsg : public Module virtual ~ModuleRestrictMsg() { - delete Srv; } virtual Version GetVersion() @@ -86,9 +86,9 @@ class ModuleRestrictMsgFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleRestrictMsg; + return new ModuleRestrictMsg(Me); } }; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index f82bba203..553211c60 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -57,15 +57,15 @@ void handle_sajoin(char **parameters, int pcnt, userrec *user) class ModuleSajoin : public Module { public: - ModuleSajoin() + ModuleSajoin(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SAJOIN",handle_sajoin,'o',2,"m_sajoin.so"); } virtual ~ModuleSajoin() { - delete Srv; } virtual Version GetVersion() @@ -88,9 +88,9 @@ class ModuleSajoinFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSajoin; + return new ModuleSajoin(Me); } }; diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index a20cb9ab9..e60f8bf03 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -61,15 +61,15 @@ void handle_samode(char **parameters, int pcnt, userrec *user) class ModuleSaMode : public Module { public: - ModuleSaMode() + ModuleSaMode(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SAMODE",handle_samode,'o',2,"m_samode.so"); } virtual ~ModuleSaMode() { - delete Srv; } virtual Version GetVersion() @@ -95,9 +95,9 @@ class ModuleSaModeFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSaMode; + return new ModuleSaMode(Me); } }; diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 4de8cf55d..056ccafd2 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -45,15 +45,15 @@ void handle_sanick(char **parameters, int pcnt, userrec *user) class ModuleSanick : public Module { public: - ModuleSanick() + ModuleSanick(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SANICK",handle_sanick,'o',2,"m_sanick.so"); } virtual ~ModuleSanick() { - delete Srv; } virtual Version GetVersion() @@ -76,9 +76,9 @@ class ModuleSanickFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSanick; + return new ModuleSanick(Me); } }; diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index a403accc7..21e2f7fbe 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -49,15 +49,15 @@ void handle_sapart(char **parameters, int pcnt, userrec *user) class ModuleSapart : public Module { public: - ModuleSapart() + ModuleSapart(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SAPART",handle_sapart,'o',2,"m_sapart.so"); } virtual ~ModuleSapart() { - delete Srv; } virtual Version GetVersion() @@ -80,9 +80,9 @@ class ModuleSapartFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSapart; + return new ModuleSapart(Me); } }; diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 40c81ccb0..e864546e0 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -57,15 +57,15 @@ void handle_saquit(char **parameters, int pcnt, userrec *user) class ModuleSaquit : public Module { public: - ModuleSaquit() + ModuleSaquit(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SAQUIT",handle_saquit,'o',2,"m_saquit.so"); } virtual ~ModuleSaquit() { - delete Srv; } virtual Version GetVersion() @@ -88,9 +88,9 @@ class ModuleSaquitFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSaquit; + return new ModuleSaquit(Me); } }; diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index d98e218a7..22d3242b7 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -30,9 +30,10 @@ class ModuleServices : public Module { Server *Srv; public: - ModuleServices() + ModuleServices(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('r',MT_CHANNEL,false,0,0); Srv->AddExtendedMode('r',MT_CLIENT,false,0,0); @@ -205,7 +206,6 @@ class ModuleServices : public Module virtual ~ModuleServices() { - delete Srv; } virtual Version GetVersion() @@ -231,9 +231,9 @@ class ModuleServicesFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleServices; + return new ModuleServices(Me); } }; diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index d4f8a4f1d..cdb01de4d 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -48,15 +48,15 @@ void handle_sethost(char **parameters, int pcnt, userrec *user) class ModuleSetHost : public Module { public: - ModuleSetHost() + ModuleSetHost(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SETHOST",handle_sethost,'o',1,"m_sethost.so"); } virtual ~ModuleSetHost() { - delete Srv; } virtual Version GetVersion() @@ -79,9 +79,9 @@ class ModuleSetHostFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSetHost; + return new ModuleSetHost(Me); } }; diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 6b2778e79..3ec1719da 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -46,16 +46,15 @@ void handle_setidle(char **parameters, int pcnt, userrec *user) class ModuleSetIdle : public Module { public: - ModuleSetIdle() + ModuleSetIdle(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SETIDLE",handle_setidle,'o',1,"m_setidle.so"); } virtual ~ModuleSetIdle() { - if (Srv) - delete Srv; } virtual Version GetVersion() @@ -78,9 +77,9 @@ class ModuleSetIdleFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSetIdle; + return new ModuleSetIdle(Me); } }; diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 2d59cb7b8..3b2d98aae 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -42,15 +42,15 @@ void handle_setname(char **parameters, int pcnt, userrec *user) class ModuleSetName : public Module { public: - ModuleSetName() + ModuleSetName(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SETNAME",handle_setname,0,1,"m_setname.so"); } virtual ~ModuleSetName() { - delete Srv; } virtual Version GetVersion() @@ -73,9 +73,9 @@ class ModuleSetNameFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSetName; + return new ModuleSetName(Me); } }; diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index e19eddb1e..c16135679 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -9,20 +9,20 @@ using namespace std; /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */ -Server *Srv; - class ModuleShowwhois : public Module { + Server* Srv; + public: - ModuleShowwhois() + ModuleShowwhois(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('W',MT_CLIENT,true,0,0); } ~ModuleShowwhois() { - delete Srv; } virtual Version GetVersion() @@ -61,9 +61,9 @@ class ModuleShowwhoisFactory : public ModuleFactory { } - virtual Module* CreateModule() + virtual Module* CreateModule(Server* Me) { - return new ModuleShowwhois; + return new ModuleShowwhois(Me); } }; diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index e1c4f3fee..9933cc9bf 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -125,9 +125,10 @@ class ModuleSilence : public Module Server *Srv; public: - ModuleSilence() + ModuleSilence(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("SILENCE",handle_silence,0,0,"m_silence.so"); } @@ -199,7 +200,6 @@ class ModuleSilence : public Module virtual ~ModuleSilence() { - delete Srv; } virtual Version GetVersion() @@ -220,9 +220,9 @@ class ModuleSilenceFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSilence; + return new ModuleSilence(Me); } }; diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index c21445397..e049625fb 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1982,9 +1982,10 @@ class ModuleSpanningTree : public Module public: - ModuleSpanningTree() + ModuleSpanningTree(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Bindings.clear(); // Create the root of the tree @@ -2669,7 +2670,6 @@ class ModuleSpanningTree : public Module virtual ~ModuleSpanningTree() { - delete Srv; } virtual Version GetVersion() @@ -2690,9 +2690,9 @@ class ModuleSpanningTreeFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - TreeProtocolModule = new ModuleSpanningTree; + TreeProtocolModule = new ModuleSpanningTree(Me); return TreeProtocolModule; } diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index a2a16abef..136f33d85 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -30,9 +30,10 @@ class ModuleStripColor : public Module ConfigReader *Conf, *MyConf; public: - ModuleStripColor() + ModuleStripColor(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddExtendedMode('S',MT_CHANNEL,false,0,0); Srv->AddExtendedMode('S',MT_CLIENT,false,0,0); @@ -72,7 +73,6 @@ class ModuleStripColor : public Module virtual ~ModuleStripColor() { - delete Srv; } // ANSI colour stripping by Doc (Peter Wood) @@ -191,9 +191,9 @@ class ModuleStripColorFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleStripColor; + return new ModuleStripColor(Me); } }; diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index fdd2c7a8f..de13cca17 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -48,9 +48,10 @@ void handle_woot(char **parameters, int pcnt, userrec *user) class ModuleTestCommand : public Module { public: - ModuleTestCommand() + ModuleTestCommand(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; // Create a new command: // command will be called /WOOT, and will // call handle_woot when triggered, the @@ -102,7 +103,6 @@ class ModuleTestCommand : public Module virtual ~ModuleTestCommand() { - delete Srv; } virtual Version GetVersion() @@ -128,9 +128,9 @@ class ModuleTestCommandFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleTestCommand; + return new ModuleTestCommand(Me); } }; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 0265a1c5b..29581054f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -98,16 +98,16 @@ void handle_tban(char **parameters, int pcnt, userrec *user) class ModuleTimedBans : public Module { public: - ModuleTimedBans() + ModuleTimedBans(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("TBAN",handle_tban,0,3,"m_timedbans.so"); TimedBanList.clear(); } virtual ~ModuleTimedBans() { - delete Srv; TimedBanList.clear(); } @@ -181,9 +181,9 @@ class ModuleTimedBansFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleTimedBans; + return new ModuleTimedBans(Me); } }; diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index fa5fdd5a5..9e5b33d4e 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -47,9 +47,10 @@ void handle_userip(char **parameters, int pcnt, userrec *user) class ModuleUserIP : public Module { public: - ModuleUserIP() + ModuleUserIP(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("USERIP",handle_userip,'o',1,"m_userip.so"); } @@ -60,7 +61,6 @@ class ModuleUserIP : public Module virtual ~ModuleUserIP() { - delete Srv; } virtual Version GetVersion() @@ -83,9 +83,9 @@ class ModuleUserIPFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleUserIP; + return new ModuleUserIP(Me); } }; diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index b15a0b65c..bd3a2f707 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -183,9 +183,10 @@ class Modulewatch : public Module public: - Modulewatch() + Modulewatch(Server* Me) + : Module::Module(Me) { - Srv = new Server; + Srv = Me; Srv->AddCommand("WATCH",handle_watch,0,0,"m_watch.so"); } @@ -264,7 +265,6 @@ class Modulewatch : public Module virtual ~Modulewatch() { - delete Srv; } virtual Version GetVersion() @@ -285,9 +285,9 @@ class ModulewatchFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new Modulewatch; + return new Modulewatch(Me); } }; |