summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command_parse.cpp1
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp7
-rw-r--r--src/modules/m_allowinvite.cpp10
-rw-r--r--src/modules/m_alltime.cpp8
-rw-r--r--src/modules/m_auditorium.cpp13
-rw-r--r--src/modules/m_banexception.cpp29
-rw-r--r--src/modules/m_banredirect.cpp13
-rw-r--r--src/modules/m_blockcaps.cpp13
-rw-r--r--src/modules/m_blockcolor.cpp10
-rw-r--r--src/modules/m_botmode.cpp12
-rw-r--r--src/modules/m_callerid.cpp29
-rw-r--r--src/modules/m_cap.cpp8
-rw-r--r--src/modules/m_cban.cpp14
-rw-r--r--src/modules/m_censor.cpp20
-rw-r--r--src/modules/m_cgiirc.cpp25
-rw-r--r--src/modules/m_chanfilter.cpp25
-rw-r--r--src/modules/m_check.cpp9
-rw-r--r--src/modules/m_chghost.cpp7
-rw-r--r--src/modules/m_chgident.cpp9
-rw-r--r--src/modules/m_chgname.cpp9
-rw-r--r--src/modules/m_cloaking.cpp4
-rw-r--r--src/modules/m_clones.cpp9
-rw-r--r--src/modules/m_close.cpp9
-rw-r--r--src/modules/m_commonchans.cpp10
-rw-r--r--src/modules/m_customtitle.cpp8
-rw-r--r--src/modules/m_cycle.cpp9
-rw-r--r--src/modules/m_dccallow.cpp7
-rw-r--r--src/modules/m_deaf.cpp10
-rw-r--r--src/modules/m_delayjoin.cpp10
-rw-r--r--src/modules/m_devoice.cpp9
-rw-r--r--src/modules/m_filter.cpp148
-rw-r--r--src/modules/m_globalload.cpp20
-rw-r--r--src/modules/m_globops.cpp7
-rw-r--r--src/modules/m_helpop.cpp19
-rw-r--r--src/modules/m_hidechans.cpp11
-rw-r--r--src/modules/m_hideoper.cpp11
-rw-r--r--src/modules/m_invisible.cpp18
-rw-r--r--src/modules/m_inviteexception.cpp24
-rw-r--r--src/modules/m_joinflood.cpp10
-rw-r--r--src/modules/m_jumpserver.cpp15
-rw-r--r--src/modules/m_kicknorejoin.cpp11
-rw-r--r--src/modules/m_knock.cpp17
-rw-r--r--src/modules/m_lockserv.cpp13
-rw-r--r--src/modules/m_maphide.cpp1
-rw-r--r--src/modules/m_messageflood.cpp12
-rw-r--r--src/modules/m_nickflood.cpp11
-rw-r--r--src/modules/m_nicklock.cpp13
-rw-r--r--src/modules/m_noctcp.cpp11
-rw-r--r--src/modules/m_nokicks.cpp10
-rw-r--r--src/modules/m_nonicks.cpp11
-rw-r--r--src/modules/m_nonotice.cpp12
-rw-r--r--src/modules/m_operchans.cpp11
-rw-r--r--src/modules/m_opermotd.cpp7
-rw-r--r--src/modules/m_password_hash.cpp7
-rw-r--r--src/modules/m_permchannels.cpp13
-rw-r--r--src/modules/m_randquote.cpp12
-rw-r--r--src/modules/m_redirect.cpp10
-rw-r--r--src/modules/m_remove.cpp12
-rw-r--r--src/modules/m_rline.cpp16
-rw-r--r--src/modules/m_sajoin.cpp9
-rw-r--r--src/modules/m_sakick.cpp9
-rw-r--r--src/modules/m_samode.cpp9
-rw-r--r--src/modules/m_sanick.cpp9
-rw-r--r--src/modules/m_sapart.cpp9
-rw-r--r--src/modules/m_saquit.cpp9
-rw-r--r--src/modules/m_sasl.cpp7
-rw-r--r--src/modules/m_satopic.cpp7
-rw-r--r--src/modules/m_services_account.cpp37
-rw-r--r--src/modules/m_servprotect.cpp11
-rw-r--r--src/modules/m_sethost.cpp7
-rw-r--r--src/modules/m_setident.cpp9
-rw-r--r--src/modules/m_setidle.cpp9
-rw-r--r--src/modules/m_setname.cpp9
-rw-r--r--src/modules/m_shun.cpp15
-rw-r--r--src/modules/m_silence.cpp12
-rw-r--r--src/modules/m_spanningtree/main.cpp3
-rw-r--r--src/modules/m_sslinfo.cpp7
-rw-r--r--src/modules/m_sslmodes.cpp12
-rw-r--r--src/modules/m_stripcolor.cpp17
-rw-r--r--src/modules/m_svshold.cpp14
-rw-r--r--src/modules/m_swhois.cpp7
-rw-r--r--src/modules/m_taxonomy.cpp9
-rw-r--r--src/modules/m_timedbans.cpp8
-rw-r--r--src/modules/m_tline.cpp9
-rw-r--r--src/modules/m_uninvite.cpp9
-rw-r--r--src/modules/m_userip.cpp8
-rw-r--r--src/modules/m_vhost.cpp9
-rw-r--r--src/modules/m_watch.cpp12
88 files changed, 449 insertions, 701 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index bf025be7c..a76ca2d4f 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -431,7 +431,6 @@ void CommandParser::RemoveCommand(Commandtable::iterator safei, const char* sour
if (x->source == std::string(source))
{
cmdlist.erase(safei);
- delete x;
}
}
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index f05a73227..b7b225384 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -110,12 +110,12 @@ class ModuleSSLGnuTLS : public Module
int clientactive;
bool cred_alloc;
- CommandStartTLS* starttls;
+ CommandStartTLS starttls;
public:
ModuleSSLGnuTLS(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), starttls(Me, this)
{
ServerInstance->Modules->PublishInterface("BufferedSocketHook", this);
@@ -135,8 +135,7 @@ class ModuleSSLGnuTLS : public Module
I_OnPostConnect, I_OnEvent, I_OnHookUserIO };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
- starttls = new CommandStartTLS(ServerInstance, this);
- ServerInstance->AddCommand(starttls);
+ ServerInstance->AddCommand(&starttls);
}
virtual void OnRehash(User* user)
diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp
index 4805e1ac6..e177f8ee6 100644
--- a/src/modules/m_allowinvite.cpp
+++ b/src/modules/m_allowinvite.cpp
@@ -23,13 +23,12 @@ class AllowInvite : public SimpleChannelModeHandler
class ModuleAllowInvite : public Module
{
- AllowInvite *ni;
+ AllowInvite ni;
public:
- ModuleAllowInvite(InspIRCd* Me) : Module(Me)
+ ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me)
{
- ni = new AllowInvite(ServerInstance);
- if (!ServerInstance->Modes->AddMode(ni))
+ if (!ServerInstance->Modes->AddMode(&ni))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -62,8 +61,7 @@ class ModuleAllowInvite : public Module
virtual ~ModuleAllowInvite()
{
- ServerInstance->Modes->DelMode(ni);
- delete ni;
+ ServerInstance->Modes->DelMode(&ni);
}
virtual Version GetVersion()
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index d7ed6e765..79a94c2b6 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -50,14 +50,12 @@ class CommandAlltime : public Command
class Modulealltime : public Module
{
- CommandAlltime *mycommand;
+ CommandAlltime mycommand;
public:
Modulealltime(InspIRCd *Me)
- : Module(Me)
+ : Module(Me), mycommand(Me)
{
- mycommand = new CommandAlltime(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&mycommand);
}
virtual ~Modulealltime()
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index fa55d108e..19b37e245 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -37,19 +37,15 @@ class AuditoriumMode : public ModeHandler
class ModuleAuditorium : public Module
{
private:
- AuditoriumMode* aum;
+ AuditoriumMode aum;
bool ShowOps;
bool OperOverride;
public:
ModuleAuditorium(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), aum(Me)
{
- aum = new AuditoriumMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(aum))
- {
- delete aum;
+ if (!ServerInstance->Modes->AddMode(&aum))
throw ModuleException("Could not add new modes!");
- }
OnRehash(NULL);
@@ -60,8 +56,7 @@ class ModuleAuditorium : public Module
virtual ~ModuleAuditorium()
{
- ServerInstance->Modes->DelMode(aum);
- delete aum;
+ ServerInstance->Modes->DelMode(&aum);
}
virtual void OnRehash(User* user)
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index b93e9bf8b..93267e03c 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -37,18 +37,16 @@ class BanException : public ListModeBase
class ModuleBanException : public Module
{
- BanException* be;
-
+ BanException be;
public:
- ModuleBanException(InspIRCd* Me) : Module(Me)
+ ModuleBanException(InspIRCd* Me) : Module(Me), be(Me)
{
- be = new BanException(ServerInstance);
- if (!ServerInstance->Modes->AddMode(be))
+ if (!ServerInstance->Modes->AddMode(&be))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->PublishInterface("ChannelBanList", this);
- be->DoImplements(this);
+ be.DoImplements(this);
Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnCheckBan, I_OnCheckExtBan, I_OnCheckStringExtBan };
Me->Modules->Attach(list, this, 6);
@@ -64,7 +62,7 @@ public:
if (chan != NULL)
{
modelist *list;
- chan->GetExt(be->GetInfoKey(), list);
+ chan->GetExt(be.GetInfoKey(), list);
if (!list)
return 0;
@@ -93,7 +91,7 @@ public:
if (chan != NULL)
{
modelist *list;
- chan->GetExt(be->GetInfoKey(), list);
+ chan->GetExt(be.GetInfoKey(), list);
if (!list)
return 0;
@@ -117,7 +115,7 @@ public:
if (chan != NULL)
{
modelist* list;
- chan->GetExt(be->GetInfoKey(), list);
+ chan->GetExt(be.GetInfoKey(), list);
if (!list)
{
@@ -140,27 +138,27 @@ public:
virtual void OnCleanup(int target_type, void* item)
{
- be->DoCleanup(target_type, item);
+ be.DoCleanup(target_type, item);
}
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
{
- be->DoSyncChannel(chan, proto, opaque);
+ be.DoSyncChannel(chan, proto, opaque);
}
virtual void OnChannelDelete(Channel* chan)
{
- be->DoChannelDelete(chan);
+ be.DoChannelDelete(chan);
}
virtual void OnRehash(User* user)
{
- be->DoRehash();
+ be.DoRehash();
}
virtual const char* OnRequest(Request* request)
{
- return be->DoOnRequest(request);
+ return be.DoOnRequest(request);
}
virtual Version GetVersion()
@@ -170,8 +168,7 @@ public:
virtual ~ModuleBanException()
{
- ServerInstance->Modes->DelMode(be);
- delete be;
+ ServerInstance->Modes->DelMode(&be);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index f3f68bc7b..bec69e608 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -195,22 +195,18 @@ class BanRedirect : public ModeWatcher
class ModuleBanRedirect : public Module
{
- BanRedirect* re;
+ BanRedirect re;
bool nofollow;
Module* ExceptionModule;
public:
ModuleBanRedirect(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), re(Me)
{
- re = new BanRedirect(Me);
nofollow = false;
- if(!ServerInstance->Modes->AddModeWatcher(re))
- {
- delete re;
+ if(!ServerInstance->Modes->AddModeWatcher(&re))
throw ModuleException("Could not add mode watcher");
- }
OnRehash(NULL);
@@ -333,8 +329,7 @@ class ModuleBanRedirect : public Module
virtual ~ModuleBanRedirect()
{
- ServerInstance->Modes->DelModeWatcher(re);
- delete re;
+ ServerInstance->Modes->DelModeWatcher(&re);
}
virtual Version GetVersion()
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index f5bcfd585..8b0c73ce3 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -26,21 +26,17 @@ class BlockCaps : public SimpleChannelModeHandler
class ModuleBlockCAPS : public Module
{
- BlockCaps* bc;
+ BlockCaps bc;
int percent;
unsigned int minlen;
char capsmap[256];
public:
- ModuleBlockCAPS(InspIRCd* Me) : Module(Me)
+ ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me)
{
OnRehash(NULL);
- bc = new BlockCaps(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bc))
- {
- delete bc;
+ if (!ServerInstance->Modes->AddMode(&bc))
throw ModuleException("Could not add new modes!");
- }
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
@@ -128,8 +124,7 @@ public:
virtual ~ModuleBlockCAPS()
{
- ServerInstance->Modes->DelMode(bc);
- delete bc;
+ ServerInstance->Modes->DelMode(&bc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 6ed27d810..020627d01 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -26,13 +26,12 @@ class BlockColor : public SimpleChannelModeHandler
class ModuleBlockColour : public Module
{
bool AllowChanOps;
- BlockColor *bc;
+ BlockColor bc;
public:
- ModuleBlockColour(InspIRCd* Me) : Module(Me)
+ ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me)
{
- bc = new BlockColor(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bc))
+ if (!ServerInstance->Modes->AddMode(&bc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
@@ -83,8 +82,7 @@ class ModuleBlockColour : public Module
virtual ~ModuleBlockColour()
{
- ServerInstance->Modes->DelMode(bc);
- delete bc;
+ ServerInstance->Modes->DelMode(&bc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index 7e8993cb3..01bc46357 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -25,15 +25,12 @@ class BotMode : public SimpleUserModeHandler
class ModuleBotMode : public Module
{
-
- BotMode* bm;
+ BotMode bm;
public:
ModuleBotMode(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), bm(Me)
{
-
- bm = new BotMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bm))
+ if (!ServerInstance->Modes->AddMode(&bm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois };
ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -42,8 +39,7 @@ class ModuleBotMode : public Module
virtual ~ModuleBotMode()
{
- ServerInstance->Modes->DelMode(bm);
- delete bm;
+ ServerInstance->Modes->DelMode(&bm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index a80246d64..1b9492ce1 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -307,8 +307,8 @@ public:
class ModuleCallerID : public Module
{
private:
- CommandAccept *mycommand;
- User_g* myumode;
+ CommandAccept mycommand;
+ User_g myumode;
// Configuration variables:
unsigned int maxaccepts; // Maximum ACCEPT entries.
@@ -342,28 +342,14 @@ private:
}
public:
- ModuleCallerID(InspIRCd* Me) : Module(Me)
+ ModuleCallerID(InspIRCd* Me) : Module(Me), mycommand(Me, maxaccepts), myumode(Me)
{
OnRehash(NULL);
- mycommand = new CommandAccept(ServerInstance, maxaccepts);
- myumode = new User_g(ServerInstance);
- if (!ServerInstance->Modes->AddMode(myumode))
- {
- delete mycommand;
- delete myumode;
+ if (!ServerInstance->Modes->AddMode(&myumode))
throw ModuleException("Could not add usermode +g");
- }
- try
- {
- ServerInstance->AddCommand(mycommand);
- }
- catch (const ModuleException& e)
- {
- delete mycommand;
- delete myumode;
- throw ModuleException("Could not add command!");
- }
+
+ ServerInstance->AddCommand(&mycommand);
Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 7);
@@ -371,8 +357,7 @@ public:
virtual ~ModuleCallerID()
{
- ServerInstance->Modes->DelMode(myumode);
- delete myumode;
+ ServerInstance->Modes->DelMode(&myumode);
}
virtual Version GetVersion()
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index d70b32cde..2e9a24811 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -132,14 +132,12 @@ class CommandCAP : public Command
class ModuleCAP : public Module
{
- CommandCAP* newcommand;
+ CommandCAP newcommand;
public:
ModuleCAP(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), newcommand(Me, this)
{
- // Create a new command
- newcommand = new CommandCAP(ServerInstance, this);
- ServerInstance->AddCommand(newcommand);
+ ServerInstance->AddCommand(&newcommand);
Implementation eventlist[] = { I_OnCheckReady };
ServerInstance->Modules->Attach(eventlist, this, 1);
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 39e956272..4b0319d87 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -156,17 +156,15 @@ class CommandCBan : public Command
class ModuleCBan : public Module
{
- CommandCBan* mycommand;
- CBanFactory *f;
+ CommandCBan mycommand;
+ CBanFactory f;
public:
- ModuleCBan(InspIRCd* Me) : Module(Me)
+ ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me), f(Me)
{
- f = new CBanFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(f);
+ ServerInstance->XLines->RegisterFactory(&f);
- mycommand = new CommandCBan(Me);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&mycommand);
Implementation eventlist[] = { I_OnUserPreJoin, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
@@ -174,7 +172,7 @@ class ModuleCBan : public Module
virtual ~ModuleCBan()
{
ServerInstance->XLines->DelAll("CBAN");
- ServerInstance->XLines->UnregisterFactory(f);
+ ServerInstance->XLines->UnregisterFactory(&f);
}
virtual int OnStats(char symbol, User* user, string_list &out)
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 0f1c3f61c..9c68be7fd 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -40,24 +40,18 @@ class CensorChannel : public SimpleChannelModeHandler
class ModuleCensor : public Module
{
censor_t censors;
- CensorUser *cu;
- CensorChannel *cc;
+ CensorUser cu;
+ CensorChannel cc;
public:
ModuleCensor(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cu(Me), cc(Me)
{
/* Read the configuration file on startup.
*/
OnRehash(NULL);
- cu = new CensorUser(ServerInstance);
- cc = new CensorChannel(ServerInstance);
- if (!ServerInstance->Modes->AddMode(cu) || !ServerInstance->Modes->AddMode(cc))
- {
- delete cu;
- delete cc;
+ if (!ServerInstance->Modes->AddMode(&cu) || !ServerInstance->Modes->AddMode(&cc))
throw ModuleException("Could not add new modes!");
- }
Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRunTestSuite };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
@@ -65,10 +59,8 @@ class ModuleCensor : public Module
virtual ~ModuleCensor()
{
- ServerInstance->Modes->DelMode(cu);
- ServerInstance->Modes->DelMode(cc);
- delete cu;
- delete cc;
+ ServerInstance->Modes->DelMode(&cu);
+ ServerInstance->Modes->DelMode(&cc);
}
// format of a config entry is <badword text="shit" replace="poo">
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 1467d0f68..8b7a77941 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -53,9 +53,9 @@ typedef std::vector<CGIhost> CGIHostlist;
*/
class CommandWebirc : public Command
{
- CGIHostlist Hosts;
- bool notify;
+ bool notify;
public:
+ CGIHostlist Hosts;
CommandWebirc(InspIRCd* Instance, bool bnotify) : Command(Instance, "WEBIRC", 0, 4, true), notify(bnotify)
{
this->source = "m_cgiirc.so";
@@ -86,11 +86,6 @@ class CommandWebirc : public Command
ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s tried to use WEBIRC, but didn't match any configured webirc blocks.", user->GetFullRealHost().c_str());
return CMD_FAILURE;
}
-
- void SetHosts(CGIHostlist &phosts)
- {
- this->Hosts = phosts;
- }
};
@@ -140,15 +135,13 @@ class CGIResolver : public Resolver
class ModuleCgiIRC : public Module
{
- CommandWebirc* mycommand;
+ CommandWebirc cmd;
bool NotifyOpers;
- CGIHostlist Hosts;
public:
- ModuleCgiIRC(InspIRCd* Me) : Module(Me)
+ ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, NotifyOpers)
{
- mycommand = new CommandWebirc(Me, NotifyOpers);
OnRehash(NULL);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCleanup, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUserDisconnect, I_OnUserConnect };
ServerInstance->Modules->Attach(eventlist, this, 7);
@@ -163,7 +156,7 @@ public:
virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
- Hosts.clear();
+ cmd.Hosts.clear();
NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed.
@@ -198,7 +191,7 @@ public:
if (cgitype == INVALID)
cgitype = PASS;
- Hosts.push_back(CGIhost(hostmask,cgitype, password.length() ? password : "" ));
+ cmd.Hosts.push_back(CGIhost(hostmask,cgitype, password.length() ? password : "" ));
}
}
else
@@ -207,8 +200,6 @@ public:
continue;
}
}
-
- mycommand->SetHosts(Hosts);
}
virtual void OnCleanup(int target_type, void* item)
@@ -267,7 +258,7 @@ public:
virtual int OnUserRegister(User* user)
{
- for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++)
+ for(CGIHostlist::iterator iter = cmd.Hosts.begin(); iter != cmd.Hosts.end(); iter++)
{
if(InspIRCd::Match(user->host, iter->hostmask, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(user->GetIPString(), iter->hostmask, ascii_case_insensitive_map))
{
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 02c39aefe..d98086421 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -57,20 +57,18 @@ class ChanFilter : public ListModeBase
class ModuleChanFilter : public Module
{
-
- ChanFilter* cf;
+ ChanFilter cf;
bool hidemask;
public:
ModuleChanFilter(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cf(Me)
{
- cf = new ChanFilter(ServerInstance);
- if (!ServerInstance->Modes->AddMode(cf))
+ if (!ServerInstance->Modes->AddMode(&cf))
throw ModuleException("Could not add new modes!");
- cf->DoImplements(this);
+ cf.DoImplements(this);
Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel };
ServerInstance->Modules->Attach(eventlist, this, 6);
@@ -80,14 +78,14 @@ class ModuleChanFilter : public Module
virtual void OnChannelDelete(Channel* chan)
{
- cf->DoChannelDelete(chan);
+ cf.DoChannelDelete(chan);
}
virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0);
- cf->DoRehash();
+ cf.DoRehash();
}
virtual int ProcessMessages(User* user,Channel* chan,std::string &text)
@@ -96,7 +94,7 @@ class ModuleChanFilter : public Module
return 0;
modelist* list;
- chan->GetExt(cf->GetInfoKey(), list);
+ chan->GetExt(cf.GetInfoKey(), list);
if (list)
{
@@ -127,12 +125,12 @@ class ModuleChanFilter : public Module
virtual void OnCleanup(int target_type, void* item)
{
- cf->DoCleanup(target_type, item);
+ cf.DoCleanup(target_type, item);
}
virtual const char* OnRequest(Request* request)
{
- return cf->DoOnRequest(request);
+ return cf.DoOnRequest(request);
}
virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
@@ -142,7 +140,7 @@ class ModuleChanFilter : public Module
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
{
- cf->DoSyncChannel(chan, proto, opaque);
+ cf.DoSyncChannel(chan, proto, opaque);
}
virtual Version GetVersion()
@@ -152,8 +150,7 @@ class ModuleChanFilter : public Module
virtual ~ModuleChanFilter()
{
- ServerInstance->Modes->DelMode(cf);
- delete cf;
+ ServerInstance->Modes->DelMode(&cf);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 4172e19a3..3b79081ad 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -190,12 +190,11 @@ class CommandCheck : public Command
class ModuleCheck : public Module
{
private:
- CommandCheck *mycommand;
+ CommandCheck mycommand;
public:
- ModuleCheck(InspIRCd* Me) : Module(Me)
+ ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(Me, this)
{
- mycommand = new CommandCheck(ServerInstance, this);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&mycommand);
}
virtual ~ModuleCheck()
@@ -211,7 +210,7 @@ class ModuleCheck : public Module
{
User* user = static_cast<User*>(opaque);
user->WriteServ("304 " + std::string(user->nick) + " :CHECK meta:" + name + " " + value);
- mycommand->md_sent = true;
+ mycommand.md_sent = true;
}
};
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index e29bb1bed..cfd8f6035 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -81,15 +81,14 @@ class CommandChghost : public Command
class ModuleChgHost : public Module
{
- CommandChghost* mycommand;
+ CommandChghost cmd;
char hostmap[256];
public:
ModuleChgHost(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, hostmap)
{
OnRehash(NULL);
- mycommand = new CommandChghost(ServerInstance, hostmap);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index 82c34457a..9dc8cbd50 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -68,15 +68,12 @@ class CommandChgident : public Command
class ModuleChgIdent : public Module
{
- CommandChgident* mycommand;
-
+ CommandChgident cmd;
public:
- ModuleChgIdent(InspIRCd* Me) : Module(Me)
+ ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me)
{
- mycommand = new CommandChgident(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleChgIdent()
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index 29fc695ab..704e142bc 100644
--- a/src/modules/m_chgname.cpp
+++ b/src/modules/m_chgname.cpp
@@ -63,15 +63,12 @@ class CommandChgname : public Command
class ModuleChgName : public Module
{
- CommandChgname* mycommand;
-
+ CommandChgname cmd;
public:
- ModuleChgName(InspIRCd* Me) : Module(Me)
+ ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me)
{
- mycommand = new CommandChgname(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleChgName()
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index ae409ae93..a236300f1 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -250,16 +250,14 @@ class CloakUser : public ModeHandler
class ModuleCloaking : public Module
{
private:
-
CloakUser* cu;
- Module* HashModule;
public:
ModuleCloaking(InspIRCd* Me)
: Module(Me)
{
/* Attempt to locate the md5 service provider, bail if we can't find it */
- HashModule = ServerInstance->Modules->Find("m_md5.so");
+ Module* HashModule = ServerInstance->Modules->Find("m_md5.so");
if (!HashModule)
throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_cloaking.so.");
diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp
index fb1c0227c..58ecff17d 100644
--- a/src/modules/m_clones.cpp
+++ b/src/modules/m_clones.cpp
@@ -60,14 +60,11 @@ class CommandClones : public Command
class ModuleClones : public Module
{
private:
- CommandClones *mycommand;
+ CommandClones cmd;
public:
- ModuleClones(InspIRCd* Me) : Module(Me)
+ ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandClones(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleClones()
diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp
index 8c8fa92f5..1520c9df4 100644
--- a/src/modules/m_close.cpp
+++ b/src/modules/m_close.cpp
@@ -65,15 +65,12 @@ class CommandClose : public Command
class ModuleClose : public Module
{
- CommandClose* newcommand;
+ CommandClose cmd;
public:
ModuleClose(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- // Create a new command
- newcommand = new CommandClose(ServerInstance);
- ServerInstance->AddCommand(newcommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleClose()
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp
index 661acbe2e..1e8471955 100644
--- a/src/modules/m_commonchans.cpp
+++ b/src/modules/m_commonchans.cpp
@@ -47,12 +47,11 @@ class PrivacyMode : public ModeHandler
class ModulePrivacyMode : public Module
{
- PrivacyMode* pm;
+ PrivacyMode pm;
public:
- ModulePrivacyMode(InspIRCd* Me) : Module(Me)
+ ModulePrivacyMode(InspIRCd* Me) : Module(Me), pm(Me)
{
- pm = new PrivacyMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(pm))
+ if (!ServerInstance->Modes->AddMode(&pm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -61,8 +60,7 @@ class ModulePrivacyMode : public Module
virtual ~ModulePrivacyMode()
{
- ServerInstance->Modes->DelMode(pm);
- delete pm;
+ ServerInstance->Modes->DelMode(&pm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp
index d2d7e1c5d..35992d505 100644
--- a/src/modules/m_customtitle.cpp
+++ b/src/modules/m_customtitle.cpp
@@ -90,14 +90,12 @@ class CommandTitle : public Command
class ModuleCustomTitle : public Module
{
- CommandTitle* mycommand;
+ CommandTitle cmd;
public:
- ModuleCustomTitle(InspIRCd* Me) : Module(Me)
+ ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandTitle(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnDecodeMetaData, I_OnWhoisLine, I_OnSyncUserMetaData, I_OnUserQuit, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 5);
}
diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp
index 327598fae..923783e4b 100644
--- a/src/modules/m_cycle.cpp
+++ b/src/modules/m_cycle.cpp
@@ -79,15 +79,12 @@ class CommandCycle : public Command
class ModuleCycle : public Module
{
- CommandCycle* mycommand;
+ CommandCycle cmd;
public:
ModuleCycle(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandCycle(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleCycle()
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 56345932c..97f0d2f13 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -244,15 +244,14 @@ class CommandDccallow : public Command
class ModuleDCCAllow : public Module
{
- CommandDccallow* mycommand;
+ CommandDccallow cmd;
public:
ModuleDCCAllow(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
Conf = new ConfigReader(ServerInstance);
- mycommand = new CommandDccallow(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
ReadFileConf();
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserQuit, I_OnUserPreNick, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 5);
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index c72d26fe5..7a810ae31 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -47,17 +47,16 @@ class User_d : public ModeHandler
class ModuleDeaf : public Module
{
- User_d* m1;
+ User_d m1;
std::string deaf_bypasschars;
std::string deaf_bypasschars_uline;
public:
ModuleDeaf(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), m1(Me)
{
- m1 = new User_d(ServerInstance);
- if (!ServerInstance->Modes->AddMode(m1))
+ if (!ServerInstance->Modes->AddMode(&m1))
throw ModuleException("Could not add new modes!");
OnRehash(NULL);
@@ -159,8 +158,7 @@ class ModuleDeaf : public Module
virtual ~ModuleDeaf()
{
- ServerInstance->Modes->DelMode(m1);
- delete m1;
+ ServerInstance->Modes->DelMode(&m1);
}
virtual Version GetVersion()
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index 707557f08..11ce78aff 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -28,13 +28,12 @@ class DelayJoinMode : public ModeHandler
class ModuleDelayJoin : public Module
{
private:
- DelayJoinMode* djm;
+ DelayJoinMode djm;
CUList nl;
public:
- ModuleDelayJoin(InspIRCd* Me) : Module(Me)
+ ModuleDelayJoin(InspIRCd* Me) : Module(Me), djm(Me, this)
{
- djm = new DelayJoinMode(ServerInstance, this);
- if (!ServerInstance->Modes->AddMode(djm))
+ if (!ServerInstance->Modes->AddMode(&djm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnText, I_OnHostCycle };
ServerInstance->Modules->Attach(eventlist, this, 7);
@@ -76,8 +75,7 @@ ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channe
ModuleDelayJoin::~ModuleDelayJoin()
{
- ServerInstance->Modes->DelMode(djm);
- delete djm;
+ ServerInstance->Modes->DelMode(&djm);
}
Version ModuleDelayJoin::GetVersion()
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index 940f13c2d..0e6f68480 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -53,14 +53,11 @@ class CommandDevoice : public Command
class ModuleDeVoice : public Module
{
- CommandDevoice *mycommand;
+ CommandDevoice cmd;
public:
- ModuleDeVoice(InspIRCd* Me) : Module(Me)
+ ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandDevoice(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleDeVoice()
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index fb4538224..9c4788f46 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -95,11 +95,28 @@ class FilterResult : public classbase
}
};
-class CommandFilter;
+class FilterBase;
+
+class CommandFilter : public Command
+{
+ FilterBase* Base;
+ public:
+ CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1, 5), Base(f)
+ {
+ this->source = ssource;
+ this->syntax = "<filter-definition> <action> <flags> [<gline-duration>] :<reason>";
+ }
+ CmdResult Handle(const std::vector<std::string>&, User*);
+
+ void TooFewParams(User* user, const std::string &extra_text)
+ {
+ user->WriteServ("NOTICE %s :*** Not enough parameters%s", user->nick.c_str(), extra_text.c_str());
+ }
+};
class FilterBase : public Module
{
- CommandFilter* filtcommand;
+ CommandFilter filtcommand;
int flags;
protected:
std::vector<std::string> exemptfromfilter; // List of channel names excluded from filtering.
@@ -126,99 +143,83 @@ protected:
virtual void ReadFilters(ConfigReader &MyConf) = 0;
};
-class CommandFilter : public Command
+CmdResult CommandFilter::Handle(const std::vector<std::string> &parameters, User *user)
{
- FilterBase* Base;
- public:
- CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1, 5), Base(f)
+ if (parameters.size() == 1)
{
- this->source = ssource;
- this->syntax = "<filter-definition> <action> <flags> [<gline-duration>] :<reason>";
- }
-
- CmdResult Handle(const std::vector<std::string> &parameters, User *user)
- {
- if (parameters.size() == 1)
+ /* Deleting a filter */
+ if (Base->DeleteFilter(parameters[0]))
{
- /* Deleting a filter */
- if (Base->DeleteFilter(parameters[0]))
- {
- user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str());
- ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'");
- return CMD_SUCCESS;
- }
- else
- {
- user->WriteServ("NOTICE %s :*** Filter '%s' not found in list, try /stats s.", user->nick.c_str(), parameters[0].c_str());
- return CMD_FAILURE;
- }
+ user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str());
+ ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'");
+ return CMD_SUCCESS;
}
else
{
- /* Adding a filter */
- if (parameters.size() >= 4)
- {
- std::string freeform = parameters[0];
- std::string type = parameters[1];
- std::string flags = parameters[2];
- std::string reason;
- long duration = 0;
+ user->WriteServ("NOTICE %s :*** Filter '%s' not found in list, try /stats s.", user->nick.c_str(), parameters[0].c_str());
+ return CMD_FAILURE;
+ }
+ }
+ else
+ {
+ /* Adding a filter */
+ if (parameters.size() >= 4)
+ {
+ std::string freeform = parameters[0];
+ std::string type = parameters[1];
+ std::string flags = parameters[2];
+ std::string reason;
+ long duration = 0;
- if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent"))
- {
- user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick.c_str(), type.c_str());
- return CMD_FAILURE;
- }
+ if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent"))
+ {
+ user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick.c_str(), type.c_str());
+ return CMD_FAILURE;
+ }
- if (type == "gline")
+ if (type == "gline")
+ {
+ if (parameters.size() >= 5)
{
- if (parameters.size() >= 5)
- {
- duration = ServerInstance->Duration(parameters[3]);
- reason = parameters[4];
- }
- else
- {
- this->TooFewParams(user, ": When setting a gline type filter, a gline duration must be specified as the third parameter.");
- return CMD_FAILURE;
- }
+ duration = ServerInstance->Duration(parameters[3]);
+ reason = parameters[4];
}
else
{
- reason = parameters[3];
+ this->TooFewParams(user, ": When setting a gline type filter, a gline duration must be specified as the third parameter.");
+ return CMD_FAILURE;
}
- std::pair<bool, std::string> result = Base->AddFilter(freeform, type, reason, duration, flags);
- if (result.first)
- {
- user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(),
- type.c_str(), (duration ? ", duration " : ""), (duration ? parameters[3].c_str() : ""),
- flags.c_str(), reason.c_str());
+ }
+ else
+ {
+ reason = parameters[3];
+ }
+ std::pair<bool, std::string> result = Base->AddFilter(freeform, type, reason, duration, flags);
+ if (result.first)
+ {
+ user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(),
+ type.c_str(), (duration ? ", duration " : ""), (duration ? parameters[3].c_str() : ""),
+ flags.c_str(), reason.c_str());
- ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" added filter '"+freeform+"', type '"+type+"', "+(duration ? "duration "+parameters[3]+", " : "")+"flags '"+flags+"', reason: "+reason);
+ ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" added filter '"+freeform+"', type '"+type+"', "+(duration ? "duration "+parameters[3]+", " : "")+"flags '"+flags+"', reason: "+reason);
- return CMD_SUCCESS;
- }
- else
- {
- user->WriteServ("NOTICE %s :*** Filter '%s' could not be added: %s", user->nick.c_str(), freeform.c_str(), result.second.c_str());
- return CMD_FAILURE;
- }
+ return CMD_SUCCESS;
}
else
{
- this->TooFewParams(user, ".");
+ user->WriteServ("NOTICE %s :*** Filter '%s' could not be added: %s", user->nick.c_str(), freeform.c_str(), result.second.c_str());
return CMD_FAILURE;
}
-
}
- }
+ else
+ {
+ this->TooFewParams(user, ".");
+ return CMD_FAILURE;
+ }
- void TooFewParams(User* user, const std::string &extra_text)
- {
- user->WriteServ("NOTICE %s :*** Not enough parameters%s", user->nick.c_str(), extra_text.c_str());
}
-};
+}
bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags)
{
@@ -235,11 +236,10 @@ bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags)
return true;
}
-FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me)
+FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me), filtcommand(this, Me, source)
{
Me->Modules->UseInterface("RegularExpression");
- filtcommand = new CommandFilter(this, Me, source);
- ServerInstance->AddCommand(filtcommand);
+ ServerInstance->AddCommand(&filtcommand);
Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnLoadModule };
ServerInstance->Modules->Attach(eventlist, this, 8);
}
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index 22035178c..a3e314846 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -125,21 +125,17 @@ class CommandGreloadmodule : public Command
class ModuleGlobalLoad : public Module
{
- CommandGloadmodule *mycommand;
- CommandGunloadmodule *mycommand2;
- CommandGreloadmodule *mycommand3;
+ CommandGloadmodule cmd1;
+ CommandGunloadmodule cmd2;
+ CommandGreloadmodule cmd3;
public:
- ModuleGlobalLoad(InspIRCd* Me) : Module(Me)
+ ModuleGlobalLoad(InspIRCd* Me)
+ : Module(Me), cmd1(Me), cmd2(Me), cmd3(Me)
{
-
- mycommand = new CommandGloadmodule(ServerInstance);
- mycommand2 = new CommandGunloadmodule(ServerInstance);
- mycommand3 = new CommandGreloadmodule(ServerInstance);
- ServerInstance->AddCommand(mycommand);
- ServerInstance->AddCommand(mycommand2);
- ServerInstance->AddCommand(mycommand3);
-
+ ServerInstance->AddCommand(&cmd1);
+ ServerInstance->AddCommand(&cmd2);
+ ServerInstance->AddCommand(&cmd3);
}
virtual ~ModuleGlobalLoad()
diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp
index bbdcc65aa..934a4ec14 100644
--- a/src/modules/m_globops.cpp
+++ b/src/modules/m_globops.cpp
@@ -45,13 +45,12 @@ class CommandGlobops : public Command
class ModuleGlobops : public Module
{
- CommandGlobops* mycommand;
+ CommandGlobops cmd;
public:
ModuleGlobops(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- mycommand = new CommandGlobops(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
}
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 0f65d7dfa..4800ebac8 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -114,21 +114,19 @@ class ModuleHelpop : public Module
{
private:
std::string h_file;
- CommandHelpop* mycommand;
- Helpop* ho;
+ CommandHelpop cmd;
+ Helpop ho;
public:
ModuleHelpop(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me), ho(Me)
{
ReadConfig();
- ho = new Helpop(ServerInstance);
- if (!ServerInstance->Modes->AddMode(ho))
+ if (!ServerInstance->Modes->AddMode(&ho))
throw ModuleException("Could not add new modes!");
- mycommand = new CommandHelpop(ServerInstance);
- ServerInstance->AddCommand(mycommand);
- Implementation eventlist[] = { I_OnRehash, I_OnWhois };
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ ServerInstance->AddCommand(&cmd);
+ Implementation eventlist[] = { I_OnRehash, I_OnWhois };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual void ReadConfig()
@@ -179,8 +177,7 @@ class ModuleHelpop : public Module
virtual ~ModuleHelpop()
{
- ServerInstance->Modes->DelMode(ho);
- delete ho;
+ ServerInstance->Modes->DelMode(&ho);
}
virtual Version GetVersion()
diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp
index 8ca14f1a4..96f5ef560 100644
--- a/src/modules/m_hidechans.cpp
+++ b/src/modules/m_hidechans.cpp
@@ -48,13 +48,11 @@ class HideChans : public ModeHandler
class ModuleHideChans : public Module
{
bool AffectsOpers;
- HideChans* hm;
+ HideChans hm;
public:
- ModuleHideChans(InspIRCd* Me) : Module(Me)
+ ModuleHideChans(InspIRCd* Me) : Module(Me), hm(Me)
{
-
- hm = new HideChans(ServerInstance);
- if (!ServerInstance->Modes->AddMode(hm))
+ if (!ServerInstance->Modes->AddMode(&hm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -63,8 +61,7 @@ class ModuleHideChans : public Module
virtual ~ModuleHideChans()
{
- ServerInstance->Modes->DelMode(hm);
- delete hm;
+ ServerInstance->Modes->DelMode(&hm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index c08a42860..c204d51e9 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -47,15 +47,13 @@ class HideOper : public ModeHandler
class ModuleHideOper : public Module
{
-
- HideOper* hm;
+ HideOper hm;
public:
ModuleHideOper(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), hm(Me)
{
- hm = new HideOper(ServerInstance);
- if (!ServerInstance->Modes->AddMode(hm))
+ if (!ServerInstance->Modes->AddMode(&hm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine };
ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -64,8 +62,7 @@ class ModuleHideOper : public Module
virtual ~ModuleHideOper()
{
- ServerInstance->Modes->DelMode(hm);
- delete hm;
+ ServerInstance->Modes->DelMode(&hm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 2e34b4f5d..c54014c85 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -130,18 +130,16 @@ class InvisibleDeOper : public ModeWatcher
class ModuleInvisible : public Module
{
private:
- InvisibleMode* qm;
- InvisibleDeOper* ido;
+ InvisibleMode qm;
+ InvisibleDeOper ido;
public:
ModuleInvisible(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), qm(Me), ido(Me)
{
conf = new ConfigReader(ServerInstance);
- qm = new InvisibleMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(qm))
+ if (!ServerInstance->Modes->AddMode(&qm))
throw ModuleException("Could not add new modes!");
- ido = new InvisibleDeOper(ServerInstance);
- if (!ServerInstance->Modes->AddModeWatcher(ido))
+ if (!ServerInstance->Modes->AddModeWatcher(&ido))
throw ModuleException("Could not add new mode watcher on usermode +o!");
/* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */
@@ -152,10 +150,8 @@ class ModuleInvisible : public Module
virtual ~ModuleInvisible()
{
- ServerInstance->Modes->DelMode(qm);
- ServerInstance->Modes->DelModeWatcher(ido);
- delete qm;
- delete ido;
+ ServerInstance->Modes->DelMode(&qm);
+ ServerInstance->Modes->DelModeWatcher(&ido);
delete conf;
};
diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp
index 130ca9a43..5acdf4f97 100644
--- a/src/modules/m_inviteexception.cpp
+++ b/src/modules/m_inviteexception.cpp
@@ -39,16 +39,15 @@ class InviteException : public ListModeBase
class ModuleInviteException : public Module
{
- InviteException* ie;
+ InviteException ie;
public:
- ModuleInviteException(InspIRCd* Me) : Module(Me)
+ ModuleInviteException(InspIRCd* Me) : Module(Me), ie(Me)
{
- ie = new InviteException(ServerInstance);
- if (!ServerInstance->Modes->AddMode(ie))
+ if (!ServerInstance->Modes->AddMode(&ie))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->PublishInterface("ChannelBanList", this);
- ie->DoImplements(this);
+ ie.DoImplements(this);
Implementation eventlist[] = { I_OnRequest, I_On005Numeric, I_OnCheckInvite };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
@@ -63,7 +62,7 @@ public:
if(chan != NULL)
{
modelist* list;
- chan->GetExt(ie->GetInfoKey(), list);
+ chan->GetExt(ie.GetInfoKey(), list);
if (list)
{
std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
@@ -84,27 +83,27 @@ public:
virtual const char* OnRequest(Request* request)
{
- return ie->DoOnRequest(request);
+ return ie.DoOnRequest(request);
}
virtual void OnCleanup(int target_type, void* item)
{
- ie->DoCleanup(target_type, item);
+ ie.DoCleanup(target_type, item);
}
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
{
- ie->DoSyncChannel(chan, proto, opaque);
+ ie.DoSyncChannel(chan, proto, opaque);
}
virtual void OnChannelDelete(Channel* chan)
{
- ie->DoChannelDelete(chan);
+ ie.DoChannelDelete(chan);
}
virtual void OnRehash(User* user)
{
- ie->DoRehash();
+ ie.DoRehash();
}
virtual Version GetVersion()
@@ -114,8 +113,7 @@ public:
~ModuleInviteException()
{
- ServerInstance->Modes->DelMode(ie);
- delete ie;
+ ServerInstance->Modes->DelMode(&ie);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index cb8c90e09..1af3ebe1d 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -203,16 +203,15 @@ class JoinFlood : public ModeHandler
class ModuleJoinFlood : public Module
{
- JoinFlood* jf;
+ JoinFlood jf;
public:
ModuleJoinFlood(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), jf(Me)
{
- jf = new JoinFlood(ServerInstance);
- if (!ServerInstance->Modes->AddMode(jf))
+ if (!ServerInstance->Modes->AddMode(&jf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreJoin, I_OnUserJoin };
ServerInstance->Modules->Attach(eventlist, this, 3);
@@ -269,8 +268,7 @@ class ModuleJoinFlood : public Module
virtual ~ModuleJoinFlood()
{
- ServerInstance->Modes->DelMode(jf);
- delete jf;
+ ServerInstance->Modes->DelMode(&jf);
}
virtual Version GetVersion()
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index 2fb509af1..f97e64258 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -134,14 +134,12 @@ class CommandJumpserver : public Command
class ModuleJumpServer : public Module
{
- CommandJumpserver* js;
+ CommandJumpserver js;
public:
ModuleJumpServer(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), js(Me)
{
-
- js = new CommandJumpserver(ServerInstance);
- ServerInstance->AddCommand(js);
+ ServerInstance->AddCommand(&js);
Implementation eventlist[] = { I_OnUserRegister };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
@@ -152,10 +150,11 @@ class ModuleJumpServer : public Module
virtual int OnUserRegister(User* user)
{
- if (js->port && js->redirect_new_users)
+ if (js.port && js.redirect_new_users)
{
- user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", user->nick.c_str(), js->redirect_to.c_str(), js->port);
- ServerInstance->Users->QuitUser(user, js->reason);
+ user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead",
+ user->nick.c_str(), js.redirect_to.c_str(), js.port);
+ ServerInstance->Users->QuitUser(user, js.reason);
return 0;
}
return 0;
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 9e12b4e18..678321033 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -112,16 +112,14 @@ class KickRejoin : public ModeHandler
class ModuleKickNoRejoin : public Module
{
- KickRejoin* kr;
+ KickRejoin kr;
public:
ModuleKickNoRejoin(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), kr(Me)
{
-
- kr = new KickRejoin(ServerInstance);
- if (!ServerInstance->Modes->AddMode(kr))
+ if (!ServerInstance->Modes->AddMode(&kr))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnUserPreJoin, I_OnUserKick };
ServerInstance->Modules->Attach(eventlist, this, 4);
@@ -201,8 +199,7 @@ public:
virtual ~ModuleKickNoRejoin()
{
- ServerInstance->Modes->DelMode(kr);
- delete kr;
+ ServerInstance->Modes->DelMode(&kr);
}
virtual Version GetVersion()
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 5e6501699..45b213b40 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -78,26 +78,21 @@ class Knock : public SimpleChannelModeHandler
class ModuleKnock : public Module
{
- CommandKnock* mycommand;
- Knock* kn;
+ CommandKnock cmd;
+ Knock kn;
public:
- ModuleKnock(InspIRCd* Me) : Module(Me)
+ ModuleKnock(InspIRCd* Me) : Module(Me), cmd(Me), kn(Me)
{
- kn = new Knock(ServerInstance);
-
- if (!ServerInstance->Modes->AddMode(kn))
+ if (!ServerInstance->Modes->AddMode(&kn))
throw ModuleException("Could not add new modes!");
-
- mycommand = new CommandKnock(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleKnock()
{
- ServerInstance->Modes->DelMode(kn);
- delete kn;
+ ServerInstance->Modes->DelMode(&kn);
}
virtual Version GetVersion()
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index f25ba0553..77dc5a219 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -71,8 +71,8 @@ class ModuleLockserv : public Module
{
private:
bool locked;
- CommandLockserv* lockcommand;
- CommandUnlockserv* unlockcommand;
+ CommandLockserv lockcommand;
+ CommandUnlockserv unlockcommand;
virtual void ResetLocked()
{
@@ -80,14 +80,11 @@ private:
}
public:
- ModuleLockserv(InspIRCd* Me) : Module(Me)
+ ModuleLockserv(InspIRCd* Me) : Module(Me), lockcommand(Me, locked), unlockcommand(Me, locked)
{
ResetLocked();
- lockcommand = new CommandLockserv(ServerInstance, locked);
- ServerInstance->AddCommand(lockcommand);
-
- unlockcommand = new CommandUnlockserv(ServerInstance, locked);
- ServerInstance->AddCommand(unlockcommand);
+ ServerInstance->AddCommand(&lockcommand);
+ ServerInstance->AddCommand(&unlockcommand);
Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp
index 637efa765..3c3b9a39b 100644
--- a/src/modules/m_maphide.cpp
+++ b/src/modules/m_maphide.cpp
@@ -22,7 +22,6 @@ class ModuleMapHide : public Module
ModuleMapHide(InspIRCd* Me)
: Module(Me)
{
- // Create a new command
ServerInstance->Modules->Attach(I_OnPreCommand, this);
ServerInstance->Modules->Attach(I_OnRehash, this);
OnRehash(NULL);
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 2342870b8..75f88232b 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -198,17 +198,14 @@ class MsgFlood : public ModeHandler
class ModuleMsgFlood : public Module
{
-
- MsgFlood* mf;
+ MsgFlood mf;
public:
ModuleMsgFlood(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), mf(Me)
{
-
- mf = new MsgFlood(ServerInstance);
- if (!ServerInstance->Modes->AddMode(mf))
+ if (!ServerInstance->Modes->AddMode(&mf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNotice, I_OnUserPreMessage };
ServerInstance->Modules->Attach(eventlist, this, 3);
@@ -284,8 +281,7 @@ class ModuleMsgFlood : public Module
virtual ~ModuleMsgFlood()
{
- ServerInstance->Modes->DelMode(mf);
- delete mf;
+ ServerInstance->Modes->DelMode(&mf);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index 97055c225..1ed30f767 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -206,16 +206,14 @@ class NickFlood : public ModeHandler
class ModuleNickFlood : public Module
{
- NickFlood* jf;
+ NickFlood jf;
public:
ModuleNickFlood(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), jf(Me)
{
-
- jf = new NickFlood(ServerInstance);
- if (!ServerInstance->Modes->AddMode(jf))
+ if (!ServerInstance->Modes->AddMode(&jf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNick, I_OnUserPostNick };
ServerInstance->Modules->Attach(eventlist, this, 3);
@@ -296,8 +294,7 @@ class ModuleNickFlood : public Module
virtual ~ModuleNickFlood()
{
- ServerInstance->Modes->DelMode(jf);
- delete jf;
+ ServerInstance->Modes->DelMode(&jf);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index fe669fdcb..cc6691717 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -145,18 +145,15 @@ class CommandNickunlock : public Command
class ModuleNickLock : public Module
{
- CommandNicklock* cmd1;
- CommandNickunlock* cmd2;
+ CommandNicklock cmd1;
+ CommandNickunlock cmd2;
char* n;
public:
ModuleNickLock(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd1(Me), cmd2(Me)
{
-
- cmd1 = new CommandNicklock(ServerInstance);
- cmd2 = new CommandNickunlock(ServerInstance);
- ServerInstance->AddCommand(cmd1);
- ServerInstance->AddCommand(cmd2);
+ ServerInstance->AddCommand(&cmd1);
+ ServerInstance->AddCommand(&cmd2);
Implementation eventlist[] = { I_OnUserPreNick, I_OnUserQuit, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 2f2b3d011..b7d9295a1 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -46,16 +46,14 @@ class NoCTCP : public ModeHandler
class ModuleNoCTCP : public Module
{
- NoCTCP* nc;
+ NoCTCP nc;
public:
ModuleNoCTCP(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), nc(Me)
{
-
- nc = new NoCTCP(ServerInstance);
- if (!ServerInstance->Modes->AddMode(nc))
+ if (!ServerInstance->Modes->AddMode(&nc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
@@ -63,8 +61,7 @@ class ModuleNoCTCP : public Module
virtual ~ModuleNoCTCP()
{
- ServerInstance->Modes->DelMode(nc);
- delete nc;
+ ServerInstance->Modes->DelMode(&nc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 61ab868a5..ce43e576f 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -23,14 +23,13 @@ class NoKicks : public SimpleChannelModeHandler
class ModuleNoKicks : public Module
{
- NoKicks* nk;
+ NoKicks nk;
public:
ModuleNoKicks(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), nk(Me)
{
- nk = new NoKicks(ServerInstance);
- if (!ServerInstance->Modes->AddMode(nk))
+ if (!ServerInstance->Modes->AddMode(&nk))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnAccessCheck, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -65,8 +64,7 @@ class ModuleNoKicks : public Module
virtual ~ModuleNoKicks()
{
- ServerInstance->Modes->DelMode(nk);
- delete nk;
+ ServerInstance->Modes->DelMode(&nk);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index 08baef5df..b3b739807 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -45,21 +45,18 @@ class NoNicks : public ModeHandler
class ModuleNoNickChange : public Module
{
- NoNicks* nn;
+ NoNicks nn;
public:
- ModuleNoNickChange(InspIRCd* Me) : Module(Me)
+ ModuleNoNickChange(InspIRCd* Me) : Module(Me), nn(Me)
{
-
- nn = new NoNicks(ServerInstance);
- ServerInstance->Modes->AddMode(nn);
+ ServerInstance->Modes->AddMode(&nn);
Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual ~ModuleNoNickChange()
{
- ServerInstance->Modes->DelMode(nn);
- delete nn;
+ ServerInstance->Modes->DelMode(&nn);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index a1092ab7c..854de2901 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -23,16 +23,13 @@ class NoNotice : public SimpleChannelModeHandler
class ModuleNoNotice : public Module
{
-
- NoNotice* nt;
+ NoNotice nt;
public:
ModuleNoNotice(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), nt(Me)
{
-
- nt = new NoNotice(ServerInstance);
- if (!ServerInstance->Modes->AddMode(nt))
+ if (!ServerInstance->Modes->AddMode(&nt))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -72,8 +69,7 @@ class ModuleNoNotice : public Module
virtual ~ModuleNoNotice()
{
- ServerInstance->Modes->DelMode(nt);
- delete nt;
+ ServerInstance->Modes->DelMode(&nt);
}
virtual Version GetVersion()
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 50aa0aa87..8723f6ca0 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -47,14 +47,12 @@ class OperChans : public ModeHandler
class ModuleOperChans : public Module
{
- OperChans* oc;
+ OperChans oc;
public:
ModuleOperChans(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), oc(Me)
{
-
- oc = new OperChans(ServerInstance);
- if (!ServerInstance->Modes->AddMode(oc))
+ if (!ServerInstance->Modes->AddMode(&oc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnCheckBan, I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -81,8 +79,7 @@ class ModuleOperChans : public Module
virtual ~ModuleOperChans()
{
- ServerInstance->Modes->DelMode(oc);
- delete oc;
+ ServerInstance->Modes->DelMode(&oc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index fcb5f1a69..9caa73d91 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -58,7 +58,7 @@ class CommandOpermotd : public Command
class ModuleOpermotd : public Module
{
- CommandOpermotd* mycommand;
+ CommandOpermotd cmd;
bool onoper;
public:
@@ -78,11 +78,10 @@ class ModuleOpermotd : public Module
}
ModuleOpermotd(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
opermotd = NULL;
- mycommand = new CommandOpermotd(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
opermotd = new FileReader(ServerInstance);
LoadOperMOTD();
Implementation eventlist[] = { I_OnRehash, I_OnOper };
diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp
index 52c8f241c..e91bedd70 100644
--- a/src/modules/m_password_hash.cpp
+++ b/src/modules/m_password_hash.cpp
@@ -71,7 +71,7 @@ class CommandMkpasswd : public Command
class ModuleOperHash : public Module
{
- CommandMkpasswd* mycommand;
+ CommandMkpasswd cmd;
hashymodules hashers; /* List of modules which implement HashRequest */
std::deque<std::string> names; /* Module names which implement HashRequest */
@@ -79,7 +79,7 @@ class ModuleOperHash : public Module
public:
ModuleOperHash(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, this, hashers, names)
{
diduseiface = false;
@@ -109,8 +109,7 @@ class ModuleOperHash : public Module
diduseiface = true;
}
- mycommand = new CommandMkpasswd(ServerInstance, this, hashers, names);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnPassCompare, I_OnLoadModule };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index ff269934e..08a48443e 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -77,17 +77,13 @@ class PermChannel : public ModeHandler
class ModulePermanentChannels : public Module
{
- PermChannel *p;
+ PermChannel p;
public:
- ModulePermanentChannels(InspIRCd* Me) : Module(Me)
+ ModulePermanentChannels(InspIRCd* Me) : Module(Me), p(Me)
{
- p = new PermChannel(ServerInstance);
- if (!ServerInstance->Modes->AddMode(p))
- {
- delete p;
+ if (!ServerInstance->Modes->AddMode(&p))
throw ModuleException("Could not add new modes!");
- }
Implementation eventlist[] = { I_OnChannelPreDelete };
ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -96,8 +92,7 @@ public:
virtual ~ModulePermanentChannels()
{
- ServerInstance->Modes->DelMode(p);
- delete p;
+ ServerInstance->Modes->DelMode(&p);
}
virtual void OnRehash(User *user)
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 988d82a85..21cb2257d 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -55,11 +55,11 @@ class CommandRandquote : public Command
class ModuleRandQuote : public Module
{
private:
- CommandRandquote* mycommand;
+ CommandRandquote cmd;
ConfigReader *conf;
public:
ModuleRandQuote(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
conf = new ConfigReader(ServerInstance);
@@ -70,8 +70,6 @@ class ModuleRandQuote : public Module
prefix = conf->ReadValue("randquote","prefix",0);
suffix = conf->ReadValue("randquote","suffix",0);
- mycommand = NULL;
-
if (q_file.empty())
{
throw ModuleException("m_randquote: Quotefile not specified - Please check your config.");
@@ -85,8 +83,7 @@ class ModuleRandQuote : public Module
else
{
/* Hidden Command -- Mode clients assume /quote sends raw data to an IRCd >:D */
- mycommand = new CommandRandquote(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
Implementation eventlist[] = { I_OnUserConnect };
ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -106,8 +103,7 @@ class ModuleRandQuote : public Module
virtual void OnUserConnect(User* user)
{
- if (mycommand)
- mycommand->Handle(std::vector<std::string>(), user);
+ cmd.Handle(std::vector<std::string>(), user);
}
};
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index f778b5fef..1a5a48b00 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -85,16 +85,15 @@ class Redirect : public ModeHandler
class ModuleRedirect : public Module
{
- Redirect* re;
+ Redirect re;
public:
ModuleRedirect(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), re(Me)
{
- re = new Redirect(ServerInstance);
- if (!ServerInstance->Modes->AddMode(re))
+ if (!ServerInstance->Modes->AddMode(&re))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -131,8 +130,7 @@ class ModuleRedirect : public Module
virtual ~ModuleRedirect()
{
- ServerInstance->Modes->DelMode(re);
- delete re;
+ ServerInstance->Modes->DelMode(&re);
}
virtual Version GetVersion()
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 6e5eaae46..c86565b5f 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -238,19 +238,17 @@ class CommandFpart : public Command, public RemoveBase
class ModuleRemove : public Module
{
- CommandRemove* mycommand;
- CommandFpart* mycommand2;
+ CommandRemove cmd1;
+ CommandFpart cmd2;
bool supportnokicks;
public:
ModuleRemove(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd1(Me, supportnokicks), cmd2(Me, supportnokicks)
{
- mycommand = new CommandRemove(ServerInstance, supportnokicks);
- mycommand2 = new CommandFpart(ServerInstance, supportnokicks);
- ServerInstance->AddCommand(mycommand);
- ServerInstance->AddCommand(mycommand2);
+ ServerInstance->AddCommand(&cmd1);
+ ServerInstance->AddCommand(&cmd2);
OnRehash(NULL);
Implementation eventlist[] = { I_On005Numeric, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 9d090ec2e..824d6229a 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -186,25 +186,21 @@ class CommandRLine : public Command
class ModuleRLine : public Module
{
private:
- CommandRLine *r;
- RLineFactory *f;
+ CommandRLine r;
+ RLineFactory f;
bool MatchOnNickChange;
std::string RegexEngine;
public:
- ModuleRLine(InspIRCd* Me) : Module(Me)
+ ModuleRLine(InspIRCd* Me) : Module(Me), r(Me), f(Me)
{
mymodule = this;
OnRehash(NULL);
Me->Modules->UseInterface("RegularExpression");
- // Create a new command
- r = new CommandRLine(ServerInstance);
- ServerInstance->AddCommand(r);
-
- f = new RLineFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(f);
+ ServerInstance->AddCommand(&r);
+ ServerInstance->XLines->RegisterFactory(&f);
Implementation eventlist[] = { I_OnUserConnect, I_OnRehash, I_OnUserPostNick, I_OnLoadModule, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 5);
@@ -215,7 +211,7 @@ class ModuleRLine : public Module
{
ServerInstance->Modules->DoneWithInterface("RegularExpression");
ServerInstance->XLines->DelAll("R");
- ServerInstance->XLines->UnregisterFactory(f);
+ ServerInstance->XLines->UnregisterFactory(&f);
}
virtual Version GetVersion()
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index cada9890c..8fad7bc42 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -88,15 +88,12 @@ class CommandSajoin : public Command
class ModuleSajoin : public Module
{
- CommandSajoin* mycommand;
+ CommandSajoin cmd;
public:
ModuleSajoin(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSajoin(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSajoin()
diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp
index d171abe57..feceeee99 100644
--- a/src/modules/m_sakick.cpp
+++ b/src/modules/m_sakick.cpp
@@ -88,15 +88,12 @@ class CommandSakick : public Command
class ModuleSakick : public Module
{
- CommandSakick* mycommand;
+ CommandSakick cmd;
public:
ModuleSakick(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSakick(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSakick()
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 9624ee053..0011e7076 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -54,15 +54,12 @@ class CommandSamode : public Command
class ModuleSaMode : public Module
{
- CommandSamode* mycommand;
+ CommandSamode cmd;
public:
ModuleSaMode(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSamode(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSaMode()
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index e74968500..180e4ba81 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -80,15 +80,12 @@ class CommandSanick : public Command
class ModuleSanick : public Module
{
- CommandSanick* mycommand;
+ CommandSanick cmd;
public:
ModuleSanick(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSanick(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSanick()
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 85c1a8606..ba5387901 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -88,15 +88,12 @@ class CommandSapart : public Command
class ModuleSapart : public Module
{
- CommandSapart* mycommand;
+ CommandSapart cmd;
public:
ModuleSapart(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSapart(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSapart()
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index ff35b31d7..8bd1664c6 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -58,15 +58,12 @@ class CommandSaquit : public Command
class ModuleSaquit : public Module
{
- CommandSaquit* mycommand;
+ CommandSaquit cmd;
public:
ModuleSaquit(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSaquit(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSaquit()
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 1777fbc15..7867c245d 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -186,17 +186,16 @@ class CommandAuthenticate : public Command
class ModuleSASL : public Module
{
- CommandAuthenticate* sasl;
+ CommandAuthenticate sasl;
public:
ModuleSASL(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), sasl(Me, this)
{
Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnPostConnect, I_OnUserDisconnect, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 5);
- sasl = new CommandAuthenticate(ServerInstance, this);
- ServerInstance->AddCommand(sasl);
+ ServerInstance->AddCommand(&sasl);
if (!ServerInstance->Modules->Find("m_services_account.so") || !ServerInstance->Modules->Find("m_cap.so"))
ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!");
diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp
index 67756158a..7414058df 100644
--- a/src/modules/m_satopic.cpp
+++ b/src/modules/m_satopic.cpp
@@ -55,13 +55,12 @@ class CommandSATopic : public Command
class ModuleSATopic : public Module
{
- CommandSATopic* mycommand;
+ CommandSATopic cmd;
public:
ModuleSATopic(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- mycommand = new CommandSATopic(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSATopic()
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 7aebaa1b9..d6cf0b1e7 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -99,21 +99,19 @@ class AChannel_M : public SimpleChannelModeHandler
class ModuleServicesAccount : public Module
{
- AChannel_R* m1;
- AChannel_M* m2;
- AUser_R* m3;
- Channel_r *m4;
- User_r *m5;
+ AChannel_R m1;
+ AChannel_M m2;
+ AUser_R m3;
+ Channel_r m4;
+ User_r m5;
public:
- ModuleServicesAccount(InspIRCd* Me) : Module(Me)
+ ModuleServicesAccount(InspIRCd* Me) : Module(Me),
+ m1(Me), m2(Me), m3(Me), m4(Me), m5(Me)
{
- m1 = new AChannel_R(ServerInstance);
- m2 = new AChannel_M(ServerInstance);
- m3 = new AUser_R(ServerInstance);
- m4 = new Channel_r(ServerInstance);
- m5 = new User_r(ServerInstance);
- if (!ServerInstance->Modes->AddMode(m1) || !ServerInstance->Modes->AddMode(m2) || !ServerInstance->Modes->AddMode(m3) || !ServerInstance->Modes->AddMode(m4) || !ServerInstance->Modes->AddMode(m5))
+ if (!ServerInstance->Modes->AddMode(&m1) || !ServerInstance->Modes->AddMode(&m2) ||
+ !ServerInstance->Modes->AddMode(&m3) || !ServerInstance->Modes->AddMode(&m4) ||
+ !ServerInstance->Modes->AddMode(&m5))
throw ModuleException("Some other module has claimed our modes!");
Implementation eventlist[] = { I_OnWhois, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin, I_OnCheckBan,
@@ -347,16 +345,11 @@ class ModuleServicesAccount : public Module
virtual ~ModuleServicesAccount()
{
- ServerInstance->Modes->DelMode(m1);
- ServerInstance->Modes->DelMode(m2);
- ServerInstance->Modes->DelMode(m3);
- ServerInstance->Modes->DelMode(m4);
- ServerInstance->Modes->DelMode(m5);
- delete m1;
- delete m2;
- delete m3;
- delete m4;
- delete m5;
+ ServerInstance->Modes->DelMode(&m1);
+ ServerInstance->Modes->DelMode(&m2);
+ ServerInstance->Modes->DelMode(&m3);
+ ServerInstance->Modes->DelMode(&m4);
+ ServerInstance->Modes->DelMode(&m5);
}
virtual Version GetVersion()
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index 7c4aef289..22aad400e 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -41,14 +41,12 @@ class ServProtectMode : public ModeHandler
class ModuleServProtectMode : public Module
{
- ServProtectMode* bm;
+ ServProtectMode bm;
public:
ModuleServProtectMode(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), bm(Me)
{
-
- bm = new ServProtectMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(bm))
+ if (!ServerInstance->Modes->AddMode(&bm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick };
ServerInstance->Modules->Attach(eventlist, this, 5);
@@ -57,8 +55,7 @@ class ModuleServProtectMode : public Module
virtual ~ModuleServProtectMode()
{
- ServerInstance->Modes->DelMode(bm);
- delete bm;
+ ServerInstance->Modes->DelMode(&bm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index f6e38c213..a925e75c3 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -64,15 +64,14 @@ class CommandSethost : public Command
class ModuleSetHost : public Module
{
- CommandSethost* mycommand;
+ CommandSethost cmd;
char hostmap[256];
public:
ModuleSetHost(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, hostmap)
{
OnRehash(NULL);
- mycommand = new CommandSethost(ServerInstance, hostmap);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 805ca4eb0..7823b041b 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -57,15 +57,12 @@ class CommandSetident : public Command
class ModuleSetIdent : public Module
{
- CommandSetident* mycommand;
+ CommandSetident cmd;
public:
- ModuleSetIdent(InspIRCd* Me) : Module(Me)
+ ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSetident(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSetIdent()
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index 4001e5ee9..468102675 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -49,15 +49,12 @@ class CommandSetidle : public Command
class ModuleSetIdle : public Module
{
- CommandSetidle* mycommand;
+ CommandSetidle cmd;
public:
ModuleSetIdle(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSetidle(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSetIdle()
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index b70939ca2..00c76c848 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -54,15 +54,12 @@ class CommandSetname : public Command
class ModuleSetName : public Module
{
- CommandSetname* mycommand;
+ CommandSetname cmd;
public:
ModuleSetName(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandSetname(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleSetName()
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 939807bd3..f4532ecd1 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -174,20 +174,17 @@ class CommandShun : public Command
class ModuleShun : public Module
{
- CommandShun* mycommand;
- ShunFactory *f;
+ CommandShun cmd;
+ ShunFactory f;
std::set<std::string> ShunEnabledCommands;
bool NotifyOfShun;
bool affectopers;
public:
- ModuleShun(InspIRCd* Me) : Module(Me)
+ ModuleShun(InspIRCd* Me) : Module(Me), cmd(Me), f(Me)
{
- f = new ShunFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(f);
-
- mycommand = new CommandShun(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->XLines->RegisterFactory(&f);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnUserConnect, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 4);
@@ -197,7 +194,7 @@ class ModuleShun : public Module
virtual ~ModuleShun()
{
ServerInstance->XLines->DelAll("SHUN");
- ServerInstance->XLines->UnregisterFactory(f);
+ ServerInstance->XLines->UnregisterFactory(&f);
}
virtual int OnStats(char symbol, User* user, string_list& out)
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 9b5f393e5..0786c4da4 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -266,19 +266,17 @@ class CommandSilence : public Command
class ModuleSilence : public Module
{
- CommandSilence* cmdsilence;
- CommandSVSSilence *cmdsvssilence;
unsigned int maxsilence;
+ CommandSilence cmdsilence;
+ CommandSVSSilence cmdsvssilence;
public:
ModuleSilence(InspIRCd* Me)
- : Module(Me), maxsilence(32)
+ : Module(Me), maxsilence(32), cmdsilence(Me, maxsilence), cmdsvssilence(Me)
{
OnRehash(NULL);
- cmdsilence = new CommandSilence(ServerInstance,maxsilence);
- cmdsvssilence = new CommandSVSSilence(ServerInstance);
- ServerInstance->AddCommand(cmdsilence);
- ServerInstance->AddCommand(cmdsvssilence);
+ ServerInstance->AddCommand(&cmdsilence);
+ ServerInstance->AddCommand(&cmdsvssilence);
Implementation eventlist[] = { I_OnRehash, I_OnBuildExemptList, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite };
ServerInstance->Modules->Attach(eventlist, this, 7);
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 9e8fa7035..28473fdf9 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -921,6 +921,9 @@ ModuleSpanningTree::~ModuleSpanningTree()
/* This will also free the listeners */
delete Utils;
+ delete command_rconnect;
+ delete command_rsquit;
+
ServerInstance->Timers->DelTimer(RefreshTimer);
ServerInstance->Modules->DoneWithInterface("BufferedSocketHook");
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 05ba60b1d..01509653c 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -63,13 +63,12 @@ class CommandSSLInfo : public Command
class ModuleSSLInfo : public Module
{
- CommandSSLInfo* newcommand;
+ CommandSSLInfo cmd;
public:
ModuleSSLInfo(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
- newcommand = new CommandSSLInfo(ServerInstance);
- ServerInstance->AddCommand(newcommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnWhois, I_OnPreCommand };
ServerInstance->Modules->Attach(eventlist, this, 4);
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index bf742b05e..ccedd5aa2 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -66,16 +66,13 @@ class SSLMode : public ModeHandler
class ModuleSSLModes : public Module
{
- SSLMode* sslm;
+ SSLMode sslm;
public:
ModuleSSLModes(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), sslm(Me)
{
-
-
- sslm = new SSLMode(ServerInstance);
- if (!ServerInstance->Modes->AddMode(sslm))
+ if (!ServerInstance->Modes->AddMode(&sslm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -104,8 +101,7 @@ class ModuleSSLModes : public Module
virtual ~ModuleSSLModes()
{
- ServerInstance->Modes->DelMode(sslm);
- delete sslm;
+ ServerInstance->Modes->DelMode(&sslm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index 19f658ee0..4c5e7c028 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -35,16 +35,13 @@ class UserStripColor : public SimpleUserModeHandler
class ModuleStripColor : public Module
{
bool AllowChanOps;
- ChannelStripColor *csc;
- UserStripColor *usc;
+ ChannelStripColor csc;
+ UserStripColor usc;
public:
- ModuleStripColor(InspIRCd* Me) : Module(Me)
+ ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me), usc(Me)
{
- usc = new UserStripColor(ServerInstance);
- csc = new ChannelStripColor(ServerInstance);
-
- if (!ServerInstance->Modes->AddMode(usc) || !ServerInstance->Modes->AddMode(csc))
+ if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
@@ -52,10 +49,8 @@ class ModuleStripColor : public Module
virtual ~ModuleStripColor()
{
- ServerInstance->Modes->DelMode(usc);
- ServerInstance->Modes->DelMode(csc);
- delete usc;
- delete csc;
+ ServerInstance->Modes->DelMode(&usc);
+ ServerInstance->Modes->DelMode(&csc);
}
virtual void On005Numeric(std::string &output)
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index 08ba21108..ada7fbc68 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -142,17 +142,15 @@ class CommandSvshold : public Command
class ModuleSVSHold : public Module
{
- CommandSvshold *mycommand;
- SVSHoldFactory *s;
+ CommandSvshold cmd;
+ SVSHoldFactory s;
public:
- ModuleSVSHold(InspIRCd* Me) : Module(Me)
+ ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(Me), s(Me)
{
- s = new SVSHoldFactory(ServerInstance);
- ServerInstance->XLines->RegisterFactory(s);
- mycommand = new CommandSvshold(Me);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->XLines->RegisterFactory(&s);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnUserPreNick, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
@@ -183,7 +181,7 @@ class ModuleSVSHold : public Module
virtual ~ModuleSVSHold()
{
ServerInstance->XLines->DelAll("SVSHOLD");
- ServerInstance->XLines->UnregisterFactory(s);
+ ServerInstance->XLines->UnregisterFactory(&s);
}
virtual Version GetVersion()
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index da8e1b6c4..5a253069e 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -80,17 +80,16 @@ class CommandSwhois : public Command
class ModuleSWhois : public Module
{
- CommandSwhois* mycommand;
+ CommandSwhois cmd;
ConfigReader* Conf;
public:
- ModuleSWhois(InspIRCd* Me) : Module(Me)
+ ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(Me)
{
Conf = new ConfigReader(ServerInstance);
- mycommand = new CommandSwhois(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_OnDecodeMetaData, I_OnWhoisLine, I_OnSyncUserMetaData, I_OnUserQuit, I_OnCleanup, I_OnRehash, I_OnPostCommand };
ServerInstance->Modules->Attach(eventlist, this, 7);
}
diff --git a/src/modules/m_taxonomy.cpp b/src/modules/m_taxonomy.cpp
index 00f581246..fb74076c0 100644
--- a/src/modules/m_taxonomy.cpp
+++ b/src/modules/m_taxonomy.cpp
@@ -54,16 +54,13 @@ class CommandTaxonomy : public Command
class ModuleTaxonomy : public Module
{
- CommandTaxonomy* newcommand;
+ CommandTaxonomy cmd;
bool claimed;
public:
ModuleTaxonomy(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me, this, claimed)
{
-
- // Create a new command
- newcommand = new CommandTaxonomy(ServerInstance, this, claimed);
- ServerInstance->AddCommand(newcommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_ProtoSendMetaData };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 53d67e8ab..31896bfcb 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -112,14 +112,12 @@ class CommandTban : public Command
class ModuleTimedBans : public Module
{
- CommandTban* mycommand;
+ CommandTban cmd;
public:
ModuleTimedBans(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandTban(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
TimedBanList.clear();
Implementation eventlist[] = { I_OnDelBan, I_OnBackgroundTimer };
ServerInstance->Modules->Attach(eventlist, this, 2);
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp
index c0588a5e8..2ce4692bb 100644
--- a/src/modules/m_tline.cpp
+++ b/src/modules/m_tline.cpp
@@ -62,15 +62,12 @@ class CommandTline : public Command
class ModuleTLine : public Module
{
- CommandTline* newcommand;
+ CommandTline cmd;
public:
ModuleTLine(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- newcommand = new CommandTline(ServerInstance);
- ServerInstance->AddCommand(newcommand);
-
+ ServerInstance->AddCommand(&cmd);
}
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index 1adb00c1a..2cadc8524 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -79,16 +79,13 @@ class CommandUninvite : public Command
class ModuleUninvite : public Module
{
- CommandUninvite *mycommand;
+ CommandUninvite cmd;
public:
- ModuleUninvite(InspIRCd* Me) : Module(Me)
+ ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(Me)
{
-
- mycommand = new CommandUninvite(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleUninvite()
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index 00db26595..8600546bc 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -56,14 +56,12 @@ class CommandUserip : public Command
class ModuleUserIP : public Module
{
- CommandUserip* mycommand;
+ CommandUserip cmd;
public:
ModuleUserIP(InspIRCd* Me)
- : Module(Me)
+ : Module(Me), cmd(Me)
{
-
- mycommand = new CommandUserip(ServerInstance);
- ServerInstance->AddCommand(mycommand);
+ ServerInstance->AddCommand(&cmd);
Implementation eventlist[] = { I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 1);
}
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp
index a300ad3b8..005177cdb 100644
--- a/src/modules/m_vhost.cpp
+++ b/src/modules/m_vhost.cpp
@@ -58,15 +58,12 @@ class CommandVhost : public Command
class ModuleVHost : public Module
{
private:
-
- CommandVhost* mycommand;
+ CommandVhost cmd;
public:
- ModuleVHost(InspIRCd* Me) : Module(Me)
+ ModuleVHost(InspIRCd* Me) : Module(Me), cmd(Me)
{
- mycommand = new CommandVhost(ServerInstance);
- ServerInstance->AddCommand(mycommand);
-
+ ServerInstance->AddCommand(&cmd);
}
virtual ~ModuleVHost()
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index e70270424..9b98ca83b 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -367,20 +367,18 @@ class CommandWatch : public Command
class Modulewatch : public Module
{
- CommandWatch* mycommand;
- CommandSVSWatch *sw;
unsigned int maxwatch;
+ CommandWatch cmdw;
+ CommandSVSWatch sw;
public:
Modulewatch(InspIRCd* Me)
- : Module(Me), maxwatch(32)
+ : Module(Me), maxwatch(32), cmdw(Me, maxwatch), sw(Me)
{
OnRehash(NULL);
whos_watching_me = new watchentries();
- mycommand = new CommandWatch(ServerInstance, maxwatch);
- ServerInstance->AddCommand(mycommand);
- sw = new CommandSVSWatch(ServerInstance);
- ServerInstance->AddCommand(sw);
+ ServerInstance->AddCommand(&cmdw);
+ ServerInstance->AddCommand(&sw);
Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
ServerInstance->Modules->Attach(eventlist, this, 8);
}