]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_rline.cpp
Merge pull request #1018 from SaberUK/insp20+hidekills
[user/henk/code/inspircd.git] / src / modules / m_rline.cpp
index bbe8ede9aef85aa86f338a619358746c8943380a..d1ab5d9ba42cc35645ca77b54170a315f4319046 100644 (file)
@@ -41,11 +41,10 @@ class RLine : public XLine
         * @param regex Pattern to match with
         * @
         */
-       RLine(time_t s_time, long d, std::string src, std::string re, std::string regexs, dynamic_reference<RegexFactory>& rxfactory)
+       RLine(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& regexs, dynamic_reference<RegexFactory>& rxfactory)
                : XLine(s_time, d, src, re, "R")
+               , matchtext(regexs)
        {
-               matchtext = regexs;
-
                /* This can throw on failure, but if it does we DONT catch it here, we catch it and display it
                 * where the object is created, we might not ALWAYS want it to output stuff to snomask x all the time
                 */
@@ -241,7 +240,7 @@ class ModuleRLine : public Module
                ServerInstance->Modules->AddService(r);
                ServerInstance->XLines->RegisterFactory(&f);
 
-               Implementation eventlist[] = { I_OnUserConnect, I_OnRehash, I_OnUserPostNick, I_OnStats, I_OnBackgroundTimer, I_OnUnloadModule };
+               Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnUserPostNick, I_OnStats, I_OnBackgroundTimer, I_OnUnloadModule };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
@@ -256,7 +255,7 @@ class ModuleRLine : public Module
                return Version("RLINE: Regexp user banning.", VF_COMMON | VF_VENDOR, rxfactory ? rxfactory->name : "");
        }
 
-       virtual void OnUserConnect(LocalUser* user)
+       ModResult OnUserRegister(LocalUser* user)
        {
                // Apply lines on user connect
                XLine *rl = ServerInstance->XLines->MatchesLine("R", user);
@@ -265,7 +264,9 @@ class ModuleRLine : public Module
                {
                        // Bang. :P
                        rl->Apply(user);
+                       return MOD_RES_DENY;
                }
+               return MOD_RES_PASSTHRU;
        }
 
        virtual void OnRehash(User *user)
@@ -349,6 +350,12 @@ class ModuleRLine : public Module
                        ServerInstance->XLines->DelAll(f.GetType());
                }
        }
+
+       void Prioritize()
+       {
+               Module* mod = ServerInstance->Modules->Find("m_cgiirc.so");
+               ServerInstance->Modules->SetPriority(this, I_OnUserRegister, PRIORITY_AFTER, mod);
+       }
 };
 
 MODULE_INIT(ModuleRLine)