]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_quietban.cpp
Fix crash if OnCheckBan is called and there is no list, the if was reversed.
[user/henk/code/inspircd.git] / src / modules / m_quietban.cpp
index 01b2dd6dfc6fcae65259f80a39c507ef7fb5cc26..dbb9f1d519ea97313aed6dfd6297b2ff72f31210 100644 (file)
@@ -21,8 +21,8 @@ class ModuleQuietBan : public Module
  public:
        ModuleQuietBan(InspIRCd* Me) : Module(Me)
        {
-               Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
+               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'))
@@ -61,6 +67,14 @@ class ModuleQuietBan : public Module
 
                return 0;
        }
+
+       virtual void On005Numeric(std::string &output)
+       {
+               if (output.find(" EXTBAN=:") == std::string::npos)
+                       output.append(" EXTBAN=:q");
+               else
+                       output.insert(output.find(" EXTBAN=:") + 9, "q");
+       }
 };