]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_denychans.cpp
m_spanningtree Remove duplicate code for sending channel messages from RouteCommand()
[user/henk/code/inspircd.git] / src / modules / m_denychans.cpp
index b09ee7977d24d65a199db45debaef82bc988be7a..237447ac7dfd915a4a2aca69e14f48bcb0e2f0de 100644 (file)
 
 #include "inspircd.h"
 
-/* $ModDesc: Implements config tags which allow blocking of joins to channels */
-
 class ModuleDenyChannels : public Module
 {
+       ChanModeReference redirectmode;
+
  public:
-       void init() CXX11_OVERRIDE
+       ModuleDenyChannels()
+               : redirectmode(this, "redirect")
        {
-               Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        void OnRehash(User* user) CXX11_OVERRIDE
@@ -112,7 +111,7 @@ class ModuleDenyChannels : public Module
                                        {
                                                /* simple way to avoid potential loops: don't redirect to +L channels */
                                                Channel *newchan = ServerInstance->FindChan(redirect);
-                                               if ((!newchan) || (!(newchan->IsModeSet('L'))))
+                                               if ((!newchan) || (!newchan->IsModeSet(redirectmode)))
                                                {
                                                        user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname.c_str(),cname.c_str(),redirect.c_str(), reason.c_str());
                                                        Channel::JoinUser(user, redirect);