From d0aa0fab53653ed86da9773c96acaa20021f0003 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 2 Jan 2013 18:36:00 +0100 Subject: m_banredirect Remove unnecessary hooks, cleanup - Remove prioritization before m_banexception, it doesn't even hook OnUserPreJoin - Remove OnChannelDelete handler: nothing to do in that case, our extension item is automatically freed - Remove empty OnRehash handler --- src/modules/m_banredirect.cpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 95aff080a..c2dff9126 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -139,7 +139,7 @@ class BanRedirect : public ModeWatcher return false; } - Channel *c = ServerInstance->FindChan(mask[CHAN].c_str()); + Channel *c = ServerInstance->FindChan(mask[CHAN]); if (!c) { source->WriteNumeric(690, "%s :Target channel %s must exist to be set as a redirect.",source->nick.c_str(),mask[CHAN].c_str()); @@ -169,7 +169,7 @@ class BanRedirect : public ModeWatcher } /* Here 'param' doesn't have the channel on it yet */ - redirects->push_back(BanRedirectEntry(mask[CHAN].c_str(), param.c_str())); + redirects->push_back(BanRedirectEntry(mask[CHAN], param)); /* Now it does */ param.append(mask[CHAN]); @@ -227,18 +227,11 @@ class ModuleBanRedirect : public Module if(!ServerInstance->Modes->AddModeWatcher(&re)) throw ModuleException("Could not add mode watcher"); - OnRehash(NULL); - ServerInstance->Modules->AddService(re.extItem); - Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete }; + Implementation list[] = { I_OnUserPreJoin }; ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } - virtual void OnChannelDelete(Channel* chan) - { - OnCleanup(TYPE_CHANNEL, chan); - } - virtual void OnCleanup(int target_type, void* item) { if(target_type == TYPE_CHANNEL) @@ -274,10 +267,6 @@ class ModuleBanRedirect : public Module } } - virtual void OnRehash(User* user) - { - } - virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { /* This prevents recursion when a user sets multiple ban redirects in a chain @@ -353,12 +342,6 @@ class ModuleBanRedirect : public Module { return Version("Allows an extended ban (+b) syntax redirecting banned users to another channel", VF_COMMON|VF_VENDOR); } - - void Prioritize() - { - Module* banex = ServerInstance->Modules->Find("m_banexception.so"); - ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIORITY_BEFORE, &banex); - } }; MODULE_INIT(ModuleBanRedirect) -- cgit v1.2.3