]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_denychans.cpp
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / src / modules / m_denychans.cpp
index c280174f52fca174555e474937e3fcd1515211ef..9d9296c25065403299e831f13330ff780ef189a1 100644 (file)
 class ModuleDenyChannels : public Module
 {
  public:
-       ModuleDenyChannels()    {
+       void init()
+       {
                Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        virtual void OnRehash(User* user)
@@ -76,24 +77,20 @@ class ModuleDenyChannels : public Module
                }
        }
 
-       virtual ~ModuleDenyChannels()
-       {
-       }
-
        virtual Version GetVersion()
        {
                return Version("Implements config tags which allow blocking of joins to channels", VF_VENDOR);
        }
 
 
-       virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+       ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
        {
                ConfigTagList tags = ServerInstance->Config->ConfTags("badchan");
                for (ConfigIter j = tags.first; j != tags.second; ++j)
                {
                        if (InspIRCd::Match(cname, j->second->getString("name")))
                        {
-                               if (IS_OPER(user) && j->second->getBool("allowopers"))
+                               if (user->IsOper() && j->second->getBool("allowopers"))
                                {
                                        return MOD_RES_PASSTHRU;
                                }
@@ -117,13 +114,13 @@ class ModuleDenyChannels : public Module
                                                Channel *newchan = ServerInstance->FindChan(redirect);
                                                if ((!newchan) || (!(newchan->IsModeSet('L'))))
                                                {
-                                                       user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname,cname,redirect.c_str(), reason.c_str());
-                                                       Channel::JoinUser(user,redirect.c_str(),false,"",false,ServerInstance->Time());
+                                                       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, false, "", false, ServerInstance->Time());
                                                        return MOD_RES_DENY;
                                                }
                                        }
 
-                                       user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick.c_str(),cname,cname,reason.c_str());
+                                       user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick.c_str(),cname.c_str(),cname.c_str(),reason.c_str());
                                        return MOD_RES_DENY;
                                }
                        }