]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanfilter.cpp
Implement support for IPv6 GeoIP lookups.
[user/henk/code/inspircd.git] / src / modules / m_chanfilter.cpp
index ce23870041bf53b10e417e11de00b0b960b614c7..903aab33a8eeb2f5f2e724a0225a6188849152b1 100644 (file)
@@ -46,7 +46,7 @@ class ChanFilter : public ListModeBase
 
        bool ValidateParam(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
        {
-               if (word.length() > maxlen)     
+               if (word.length() > maxlen)
                {
                        user->WriteNumeric(Numerics::InvalidModeParameter(chan, this, word, "Word is too long for the spamfilter list"));
                        return false;
@@ -76,6 +76,7 @@ class ModuleChanFilter : public Module
        CheckExemption::EventProvider exemptionprov;
        ChanFilter cf;
        bool hidemask;
+       bool notifyuser;
 
  public:
 
@@ -90,6 +91,7 @@ class ModuleChanFilter : public Module
                ConfigTag* tag = ServerInstance->Config->ConfValue("chanfilter");
                hidemask = tag->getBool("hidemask");
                cf.maxlen = tag->getUInt("maxlen", 35, 10, 100);
+               notifyuser = tag->getBool("notifyuser", true);
                cf.DoRehash();
        }
 
@@ -112,10 +114,16 @@ class ModuleChanFilter : public Module
                        {
                                if (InspIRCd::Match(details.text, i->mask))
                                {
+                                       if (!notifyuser)
+                                       {
+                                               details.echo_original = true;
+                                               return MOD_RES_DENY;
+                                       }
+
                                        if (hidemask)
                                                user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (your message contained a censored word)");
                                        else
-                                               user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, i->mask, "Cannot send to channel (your message contained a censored word)");
+                                               user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (your message contained a censored word: " + i->mask + ")");
                                        return MOD_RES_DENY;
                                }
                        }