]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_banredirect.cpp
Change httpd modules to use the MODNAME constant in headers.
[user/henk/code/inspircd.git] / src / modules / m_banredirect.cpp
index a772794ab204ccb4afaf33b124f173b1c5ac7bdf..446d575df88f75810d04579adbf883bd432e9041 100644 (file)
@@ -44,7 +44,7 @@ typedef std::vector<BanRedirectEntry> BanRedirectList;
 
 class BanRedirect : public ModeWatcher
 {
-       ModeReference ban;
+       ChanModeReference ban;
  public:
        SimpleExtItem<BanRedirectList> extItem;
        BanRedirect(Module* parent)
@@ -217,15 +217,18 @@ class ModuleBanRedirect : public Module
 {
        BanRedirect re;
        bool nofollow;
+       ChanModeReference limitmode;
+       ChanModeReference redirectmode;
 
  public:
        ModuleBanRedirect()
-       : re(this)
+               : re(this)
+               , nofollow(false)
+               , limitmode(this, "limit")
+               , redirectmode(this, "redirect")
        {
-               nofollow = false;
        }
 
-
        void init() CXX11_OVERRIDE
        {
                ServerInstance->Modes->AddModeWatcher(&re);
@@ -311,9 +314,9 @@ class ModuleBanRedirect : public Module
                                                std::string destlimit;
 
                                                if (destchan)
-                                                       destlimit = destchan->GetModeParameter('l');
+                                                       destlimit = destchan->GetModeParameter(limitmode);
 
-                                               if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str())))
+                                               if(destchan && destchan->IsModeSet(redirectmode) && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str())))
                                                {
                                                        user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str());
                                                        return MOD_RES_DENY;
@@ -338,7 +341,7 @@ class ModuleBanRedirect : public Module
        {
                /* XXX is this the best place to do this? */
                if (!ServerInstance->Modes->DelModeWatcher(&re))
-                       ServerInstance->Logs->Log("m_banredirect.so", LOG_DEBUG, "Failed to delete modewatcher!");
+                       ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Failed to delete modewatcher!");
        }
 
        Version GetVersion() CXX11_OVERRIDE