]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_censor.cpp
Fix REMOVE maxparams
[user/henk/code/inspircd.git] / src / modules / m_censor.cpp
index 13527f64a90fc70d12833b0248b217d3b571d6f8..2c58e2ec4ea9fe1c1a67b591222ae3d0ec154762 100644 (file)
@@ -26,7 +26,7 @@ typedef std::map<irc::string,irc::string> censor_t;
 class CensorUser : public SimpleUserModeHandler
 {
  public:
-       CensorUser(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'G') { }
+       CensorUser(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'G') { }
 };
 
 /** Handles channel mode +G
@@ -64,10 +64,10 @@ class ModuleCensor : public Module
        }
 
        // format of a config entry is <badword text="shit" replace="poo">
-       virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+       virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
                if (!IS_LOCAL(user))
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                bool active = false;
 
@@ -77,14 +77,14 @@ class ModuleCensor : public Module
                {
                        active = ((Channel*)dest)->IsModeSet('G');
                        Channel* c = (Channel*)dest;
-                       if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetStatus(user) == STATUS_OP)
+                       if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetPrefixValue(user) == OP_VALUE)
                        {
-                               return 0;
+                               return MOD_RES_PASSTHRU;
                        }
                }
 
                if (!active)
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                irc::string text2 = text.c_str();
                for (censor_t::iterator index = censors.begin(); index != censors.end(); index++)
@@ -94,17 +94,17 @@ class ModuleCensor : public Module
                                if (index->second.empty())
                                {
                                        user->WriteNumeric(ERR_WORDFILTERED, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str());
-                                       return 1;
+                                       return MOD_RES_DENY;
                                }
 
                                SearchAndReplace(text2, index->first, index->second);
                        }
                }
                text = text2.c_str();
-               return 0;
+               return MOD_RES_PASSTHRU;
        }
 
-       virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+       virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
                return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
        }