summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp23
-rw-r--r--src/modules.cpp1
-rw-r--r--src/modules/m_allowinvite.cpp1
-rw-r--r--src/modules/m_auditorium.cpp1
-rw-r--r--src/modules/m_banexception.cpp1
-rw-r--r--src/modules/m_banredirect.cpp3
-rw-r--r--src/modules/m_blockcaps.cpp1
-rw-r--r--src/modules/m_blockcolor.cpp1
-rw-r--r--src/modules/m_botmode.cpp1
-rw-r--r--src/modules/m_callerid.cpp1
-rw-r--r--src/modules/m_censor.cpp2
-rw-r--r--src/modules/m_chanfilter.cpp1
-rw-r--r--src/modules/m_chanprotect.cpp2
-rw-r--r--src/modules/m_cloaking.cpp1
-rw-r--r--src/modules/m_commonchans.cpp1
-rw-r--r--src/modules/m_deaf.cpp1
-rw-r--r--src/modules/m_delayjoin.cpp1
-rw-r--r--src/modules/m_delaymsg.cpp1
-rw-r--r--src/modules/m_helpop.cpp1
-rw-r--r--src/modules/m_hidechans.cpp1
-rw-r--r--src/modules/m_hideoper.cpp1
-rw-r--r--src/modules/m_invisible.cpp6
-rw-r--r--src/modules/m_inviteexception.cpp1
-rw-r--r--src/modules/m_joinflood.cpp1
-rw-r--r--src/modules/m_kicknorejoin.cpp1
-rw-r--r--src/modules/m_knock.cpp1
-rw-r--r--src/modules/m_messageflood.cpp1
-rw-r--r--src/modules/m_nickflood.cpp1
-rw-r--r--src/modules/m_noctcp.cpp1
-rw-r--r--src/modules/m_nokicks.cpp1
-rw-r--r--src/modules/m_nonicks.cpp1
-rw-r--r--src/modules/m_nonotice.cpp1
-rw-r--r--src/modules/m_ojoin.cpp1
-rw-r--r--src/modules/m_operchans.cpp1
-rw-r--r--src/modules/m_operprefix.cpp1
-rw-r--r--src/modules/m_permchannels.cpp1
-rw-r--r--src/modules/m_redirect.cpp1
-rw-r--r--src/modules/m_services_account.cpp5
-rw-r--r--src/modules/m_servprotect.cpp1
-rw-r--r--src/modules/m_showwhois.cpp1
-rw-r--r--src/modules/m_sslmodes.cpp1
-rw-r--r--src/modules/m_stripcolor.cpp2
42 files changed, 24 insertions, 54 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 73b465917..845473c95 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -50,8 +50,8 @@
#include "modes/umode_s.h"
ModeHandler::ModeHandler(Module* Creator, char modeletter, ParamSpec Params, ModeType type)
- : mode(modeletter), parameters_taken(Params), list(false), m_type(type), m_paramtype(TR_TEXT),
- oper(false), prefix(0), count(0), levelrequired(HALFOP_VALUE), creator(Creator)
+ : m_paramtype(TR_TEXT), parameters_taken(Params), mode(modeletter), prefix(0), oper(false),
+ list(false), m_type(type), count(0), levelrequired(HALFOP_VALUE), creator(Creator)
{
}
@@ -188,7 +188,8 @@ ModeAction SimpleChannelModeHandler::OnModeChange(User* source, User* dest, Chan
return MODEACTION_DENY;
}
-ModeWatcher::ModeWatcher(char modeletter, ModeType type) : mode(modeletter), m_type(type)
+ModeWatcher::ModeWatcher(Module* Creator, char modeletter, ModeType type)
+ : mode(modeletter), m_type(type), creator(Creator)
{
}
@@ -683,6 +684,22 @@ bool ModeParser::DelMode(ModeHandler* mh)
return true;
}
+void ModeParser::RemoveModes(Module* mod)
+{
+ for(int i=0; i < 256; i++)
+ {
+ ModeHandler* mh = modehandlers[i];
+ if (mh && mh->creator == mod)
+ DelMode(mh);
+ for(unsigned int j=0; j < modewatchers[i].size(); j++)
+ {
+ ModeWatcher* mw = modewatchers[i][j];
+ if (mw && mw->creator == mod)
+ DelModeWatcher(mw);
+ }
+ }
+}
+
ModeHandler* ModeParser::FindMode(unsigned const char modeletter, ModeType mt)
{
unsigned char mask = 0;
diff --git a/src/modules.cpp b/src/modules.cpp
index a96dfe5e8..2a835f10d 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -567,6 +567,7 @@ bool ModuleManager::Unload(const char* filename)
this->DetachAll(modfind->second);
ServerInstance->Parser->RemoveCommands(modfind->second);
+ ServerInstance->Modes->RemoveModes(modfind->second);
ServerInstance->GlobalCulls.AddItem(modfind->second);
Modules.erase(modfind);
diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp
index 0de992501..46e4fcf90 100644
--- a/src/modules/m_allowinvite.cpp
+++ b/src/modules/m_allowinvite.cpp
@@ -62,7 +62,6 @@ class ModuleAllowInvite : public Module
virtual ~ModuleAllowInvite()
{
- ServerInstance->Modes->DelMode(&ni);
}
virtual Version GetVersion()
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index 0d149ccf2..d27ccfaad 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -59,7 +59,6 @@ class ModuleAuditorium : public Module
~ModuleAuditorium()
{
- ServerInstance->Modes->DelMode(&aum);
}
void OnRehash(User* user)
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index 35b30f0d4..782f55b92 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -133,7 +133,6 @@ public:
~ModuleBanException()
{
- ServerInstance->Modes->DelMode(&be);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 11ce93c9a..33cb4d874 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -39,7 +39,7 @@ class BanRedirect : public ModeWatcher
{
public:
SimpleExtItem<BanRedirectList> extItem;
- BanRedirect(Module* parent) : ModeWatcher('b', MODETYPE_CHANNEL),
+ BanRedirect(Module* parent) : ModeWatcher(parent, 'b', MODETYPE_CHANNEL),
extItem("banredirect", parent)
{
}
@@ -328,7 +328,6 @@ class ModuleBanRedirect : public Module
virtual ~ModuleBanRedirect()
{
- ServerInstance->Modes->DelModeWatcher(&re);
}
virtual Version GetVersion()
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 9e81050f3..326ba9986 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -124,7 +124,6 @@ public:
virtual ~ModuleBlockCAPS()
{
- ServerInstance->Modes->DelMode(&bc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 1c7cd8c52..ce8325e45 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -82,7 +82,6 @@ class ModuleBlockColour : public Module
virtual ~ModuleBlockColour()
{
- ServerInstance->Modes->DelMode(&bc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index 4c8007b8b..cc792027c 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -39,7 +39,6 @@ class ModuleBotMode : public Module
virtual ~ModuleBotMode()
{
- ServerInstance->Modes->DelMode(&bm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index b0d8f54b7..4f7017a1b 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -358,7 +358,6 @@ public:
virtual ~ModuleCallerID()
{
- ServerInstance->Modes->DelMode(&myumode);
}
virtual Version GetVersion()
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 29410962b..62d7a54d0 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -59,8 +59,6 @@ class ModuleCensor : public Module
virtual ~ModuleCensor()
{
- 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_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index cd7300372..b517d363e 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -144,7 +144,6 @@ class ModuleChanFilter : public Module
virtual ~ModuleChanFilter()
{
- ServerInstance->Modes->DelMode(&cf);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 12b5c1db4..ef6c129e1 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -327,8 +327,6 @@ class ModuleChanProtect : public Module
~ModuleChanProtect()
{
- ServerInstance->Modes->DelMode(cp);
- ServerInstance->Modes->DelMode(cf);
delete cp;
delete cf;
}
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 2bd8df80e..f8743d94c 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -330,7 +330,6 @@ class ModuleCloaking : public Module
~ModuleCloaking()
{
- ServerInstance->Modes->DelMode(cu);
delete cu;
ServerInstance->Modules->DoneWithInterface("HashRequest");
}
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp
index 20b409b9b..b6dc7af2c 100644
--- a/src/modules/m_commonchans.cpp
+++ b/src/modules/m_commonchans.cpp
@@ -60,7 +60,6 @@ class ModulePrivacyMode : public Module
virtual ~ModulePrivacyMode()
{
- ServerInstance->Modes->DelMode(&pm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 53085271a..78040e81f 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -158,7 +158,6 @@ class ModuleDeaf : public Module
virtual ~ModuleDeaf()
{
- ServerInstance->Modes->DelMode(&m1);
}
virtual Version GetVersion()
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index 41038d9cb..1a84ee694 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -75,7 +75,6 @@ ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channe
ModuleDelayJoin::~ModuleDelayJoin()
{
- ServerInstance->Modes->DelMode(&djm);
}
Version ModuleDelayJoin::GetVersion()
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index 77ac5fc59..ecc1b5b5e 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -96,7 +96,6 @@ ModeAction DelayMsgMode::OnModeChange(User* source, User* dest, Channel* channel
ModuleDelayMsg::~ModuleDelayMsg()
{
- ServerInstance->Modes->DelMode(&djm);
}
Version ModuleDelayMsg::GetVersion()
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index bcf1f1e20..c1b669d3f 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -179,7 +179,6 @@ class ModuleHelpop : public Module
virtual ~ModuleHelpop()
{
- ServerInstance->Modes->DelMode(&ho);
}
virtual Version GetVersion()
diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp
index 0d405186b..e5869f5e6 100644
--- a/src/modules/m_hidechans.cpp
+++ b/src/modules/m_hidechans.cpp
@@ -61,7 +61,6 @@ class ModuleHideChans : public Module
virtual ~ModuleHideChans()
{
- ServerInstance->Modes->DelMode(&hm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index b9ea5fa2a..62dbca127 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -65,7 +65,6 @@ class ModuleHideOper : public Module
virtual ~ModuleHideOper()
{
- ServerInstance->Modes->DelMode(&hm);
}
virtual Version GetVersion()
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index cfccc3de7..9c4a58278 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -80,7 +80,7 @@ class InvisibleMode : public ModeHandler
class InvisibleDeOper : public ModeWatcher
{
public:
- InvisibleDeOper() : ModeWatcher('o', MODETYPE_USER)
+ InvisibleDeOper(Module* parent) : ModeWatcher(parent, 'o', MODETYPE_USER)
{
}
@@ -105,7 +105,7 @@ class ModuleInvisible : public Module
InvisibleMode qm;
InvisibleDeOper ido;
public:
- ModuleInvisible() : qm(this)
+ ModuleInvisible() : qm(this), ido(this)
{
if (!ServerInstance->Modes->AddMode(&qm))
throw ModuleException("Could not add new modes!");
@@ -123,8 +123,6 @@ class ModuleInvisible : public Module
~ModuleInvisible()
{
- ServerInstance->Modes->DelMode(&qm);
- ServerInstance->Modes->DelModeWatcher(&ido);
};
Version GetVersion();
diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp
index 777e8efd7..b71992c05 100644
--- a/src/modules/m_inviteexception.cpp
+++ b/src/modules/m_inviteexception.cpp
@@ -104,7 +104,6 @@ public:
~ModuleInviteException()
{
- ServerInstance->Modes->DelMode(&ie);
ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 54e221019..015954b73 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -242,7 +242,6 @@ class ModuleJoinFlood : public Module
~ModuleJoinFlood()
{
- ServerInstance->Modes->DelMode(&jf);
}
Version GetVersion()
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 33eefadb2..c8b3e059f 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -166,7 +166,6 @@ public:
~ModuleKickNoRejoin()
{
- ServerInstance->Modes->DelMode(&kr);
}
Version GetVersion()
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index a266d0aa5..4c0e02731 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -96,7 +96,6 @@ class ModuleKnock : public Module
virtual ~ModuleKnock()
{
- ServerInstance->Modes->DelMode(&kn);
}
virtual Version GetVersion()
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 5a40664d9..da413516b 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -264,7 +264,6 @@ class ModuleMsgFlood : public Module
~ModuleMsgFlood()
{
- ServerInstance->Modes->DelMode(&mf);
}
Version GetVersion()
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index d4b07b0c4..733b55b64 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -269,7 +269,6 @@ class ModuleNickFlood : public Module
~ModuleNickFlood()
{
- ServerInstance->Modes->DelMode(&nf);
}
Version GetVersion()
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 58b9b7dcb..b9f5d581b 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -61,7 +61,6 @@ class ModuleNoCTCP : public Module
virtual ~ModuleNoCTCP()
{
- ServerInstance->Modes->DelMode(&nc);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 0a9ce2edf..157ec34f7 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -61,7 +61,6 @@ class ModuleNoKicks : public Module
~ModuleNoKicks()
{
- ServerInstance->Modes->DelMode(&nk);
}
Version GetVersion()
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index 2ed25dfe5..eeea20941 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -56,7 +56,6 @@ class ModuleNoNickChange : public Module
virtual ~ModuleNoNickChange()
{
- ServerInstance->Modes->DelMode(&nn);
}
virtual Version GetVersion()
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index c3523a7ef..dcc69f997 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -69,7 +69,6 @@ class ModuleNoNotice : public Module
virtual ~ModuleNoNotice()
{
- ServerInstance->Modes->DelMode(&nt);
}
virtual Version GetVersion()
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 5bd9e3f91..d64c5a267 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -305,7 +305,6 @@ class ModuleOjoin : public Module
~ModuleOjoin()
{
- ServerInstance->Modes->DelMode(np);
delete np;
}
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 5fe891b50..eecf4e1b9 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -84,7 +84,6 @@ class ModuleOperChans : public Module
~ModuleOperChans()
{
- ServerInstance->Modes->DelMode(&oc);
}
Version GetVersion()
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 223768dac..3a5fa2e7f 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -128,7 +128,6 @@ class ModuleOperPrefixMode : public Module
~ModuleOperPrefixMode()
{
- ServerInstance->Modes->DelMode(opm);
delete opm;
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index a409078e4..7fdc12f88 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -187,7 +187,6 @@ public:
virtual ~ModulePermanentChannels()
{
- ServerInstance->Modes->DelMode(&p);
/*
* DelMode can't remove the +P mode on empty channels, or it will break
* merging modes with remote servers. Remove the empty channels now as
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 6bd375f88..d98b8a54b 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -130,7 +130,6 @@ class ModuleRedirect : public Module
virtual ~ModuleRedirect()
{
- ServerInstance->Modes->DelMode(&re);
}
virtual Version GetVersion()
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 6e950f438..73723f4e1 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -273,11 +273,6 @@ class ModuleServicesAccount : public Module
~ModuleServicesAccount()
{
- ServerInstance->Modes->DelMode(&m1);
- ServerInstance->Modes->DelMode(&m2);
- ServerInstance->Modes->DelMode(&m3);
- ServerInstance->Modes->DelMode(&m4);
- ServerInstance->Modes->DelMode(&m5);
}
Version GetVersion()
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index 4103de81b..b38f18cc9 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -52,7 +52,6 @@ class ModuleServProtectMode : public Module
~ModuleServProtectMode()
{
- ServerInstance->Modes->DelMode(&bm);
}
Version GetVersion()
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index 9acc019aa..c14769d50 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -97,7 +97,6 @@ class ModuleShowwhois : public Module
~ModuleShowwhois()
{
- ServerInstance->Modes->DelMode(sw);
delete sw;
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index 0538f9f62..50fb17946 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -115,7 +115,6 @@ class ModuleSSLModes : public Module
~ModuleSSLModes()
{
- ServerInstance->Modes->DelMode(&sslm);
}
void On005Numeric(std::string &output)
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index 34662c45b..bf3308080 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -49,8 +49,6 @@ class ModuleStripColor : public Module
virtual ~ModuleStripColor()
{
- ServerInstance->Modes->DelMode(&usc);
- ServerInstance->Modes->DelMode(&csc);
}
virtual void On005Numeric(std::string &output)