]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_banredirect Remove unnecessary hooks, cleanup
authorattilamolnar <attilamolnar@hush.com>
Wed, 2 Jan 2013 17:36:00 +0000 (18:36 +0100)
committerattilamolnar <attilamolnar@hush.com>
Wed, 2 Jan 2013 17:36:00 +0000 (18:36 +0100)
- 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

index 95aff080ab87d240b2629ae5c62b544fdbc12e06..c2dff91267fd2621262a66628543567f253a697e 100644 (file)
@@ -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)