summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_lusers.cpp10
-rw-r--r--src/mode.cpp2
-rw-r--r--src/modules/m_banredirect.cpp12
-rw-r--r--src/modules/m_operprefix.cpp12
-rw-r--r--src/modules/m_timedbans.cpp10
5 files changed, 2 insertions, 44 deletions
diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp
index 37b193e66..7cd0f2ca1 100644
--- a/src/commands/cmd_lusers.cpp
+++ b/src/commands/cmd_lusers.cpp
@@ -154,11 +154,6 @@ class ModuleLusers : public Module
{
}
- void init()
- {
- ServerInstance->Modes->AddModeWatcher(&mw);
- }
-
void OnPostConnect(User* user)
{
counters.UpdateMaxUsers();
@@ -172,11 +167,6 @@ class ModuleLusers : public Module
counters.invisible--;
}
- ~ModuleLusers()
- {
- ServerInstance->Modes->DelModeWatcher(&mw);
- }
-
Version GetVersion()
{
return Version("LUSERS", VF_VENDOR | VF_CORE);
diff --git a/src/mode.cpp b/src/mode.cpp
index 162793369..e0381b683 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -145,10 +145,12 @@ bool ParamChannelModeHandler::ParamValidate(std::string& parameter)
ModeWatcher::ModeWatcher(Module* Creator, const std::string& modename, ModeType type)
: mode(modename), m_type(type), creator(Creator)
{
+ ServerInstance->Modes->AddModeWatcher(this);
}
ModeWatcher::~ModeWatcher()
{
+ ServerInstance->Modes->DelModeWatcher(this);
}
ModeType ModeWatcher::GetModeType()
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 31335ae8f..b0be8d665 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -229,11 +229,6 @@ class ModuleBanRedirect : public Module
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modes->AddModeWatcher(&re);
- }
-
void OnCleanup(int target_type, void* item) CXX11_OVERRIDE
{
if(target_type == TYPE_CHANNEL)
@@ -334,13 +329,6 @@ class ModuleBanRedirect : public Module
return MOD_RES_PASSTHRU;
}
- ~ModuleBanRedirect()
- {
- /* XXX is this the best place to do this? */
- if (!ServerInstance->Modes->DelModeWatcher(&re))
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Failed to delete modewatcher!");
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Allows an extended ban (+b) syntax redirecting banned users to another channel", VF_COMMON|VF_VENDOR);
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 3d2a34bdb..c84e74892 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -59,16 +59,10 @@ class ModuleOperPrefixMode : public Module
: opm(this), hideoperwatcher(this)
, hideopermode(this, "hideoper")
{
- }
-
- void init() CXX11_OVERRIDE
- {
/* To give clients a chance to learn about the new prefix we don't give +y to opers
* right now. That means if the module was loaded after opers have joined channels
* they need to rejoin them in order to get the oper prefix.
*/
-
- ServerInstance->Modes->AddModeWatcher(&hideoperwatcher);
}
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
@@ -98,12 +92,6 @@ class ModuleOperPrefixMode : public Module
SetOperPrefix(user, true);
}
-
- ~ModuleOperPrefixMode()
- {
- ServerInstance->Modes->DelModeWatcher(&hideoperwatcher);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Gives opers cmode +y which provides a staff prefix.", VF_VENDOR);
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 40cc162c1..e3a938336 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -148,16 +148,6 @@ class ModuleTimedBans : public Module
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modes->AddModeWatcher(&banwatcher);
- }
-
- ~ModuleTimedBans()
- {
- ServerInstance->Modes->DelModeWatcher(&banwatcher);
- }
-
void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE
{
timedbans expired;