]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_quietban.cpp
Fixes to make this module scale much better. Dont connect on each query, keep open...
[user/henk/code/inspircd.git] / src / modules / m_quietban.cpp
index 8ea51422039dab0de0020f4d58b0427f1489f907..dbb9f1d519ea97313aed6dfd6297b2ff72f31210 100644 (file)
@@ -22,7 +22,7 @@ class ModuleQuietBan : public Module
        ModuleQuietBan(InspIRCd* Me) : Module(Me)
        {
                Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               ServerInstance->Modules->Attach(eventlist, this, 3);
        }
        
        virtual ~ModuleQuietBan()
@@ -36,6 +36,9 @@ class ModuleQuietBan : public Module
 
        virtual int OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
        {
+               if (!IS_LOCAL(user))
+                       return 0;
+
                if (target_type == TYPE_CHANNEL)
                {
                        if (((Channel *)dest)->IsExtBanned(user, 'q'))
@@ -50,6 +53,9 @@ class ModuleQuietBan : public Module
 
        virtual int OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
        {
+               if (!IS_LOCAL(user))
+                       return 0;
+
                if (target_type == TYPE_CHANNEL)
                {
                        if (((Channel *)dest)->IsExtBanned(user, 'q'))
@@ -67,7 +73,7 @@ class ModuleQuietBan : public Module
                if (output.find(" EXTBAN=:") == std::string::npos)
                        output.append(" EXTBAN=:q");
                else
-                       output.insert(output.find(" EXTBAN=:") + 8, "q");
+                       output.insert(output.find(" EXTBAN=:") + 9, "q");
        }
 };