]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dccallow.cpp
Fix some numerics
[user/henk/code/inspircd.git] / src / modules / m_dccallow.cpp
index f011fa44929320dc8de13a79dc32296d8367fba7..0e57896f3b78c78d7317536b745660e202277b72 100644 (file)
@@ -58,6 +58,7 @@ class CommandDccallow : public Command
        DCCAllowExt& ext;
 
  public:
+       unsigned int maxentries;
        CommandDccallow(Module* parent, DCCAllowExt& Ext)
                : Command(parent, "DCCALLOW", 0)
                , ext(Ext)
@@ -104,7 +105,7 @@ class CommandDccallow : public Command
                        std::string nick(parameters[0], 1);
                        User *target = ServerInstance->FindNickOnly(nick);
 
-                       if ((target) && (!IS_SERVER(target)) && (!target->quitting) && (target->registered == REG_ALL))
+                       if ((target) && (!target->quitting) && (target->registered == REG_ALL))
                        {
 
                                if (action == '-')
@@ -142,6 +143,12 @@ class CommandDccallow : public Command
                                                ul.push_back(user);
                                        }
 
+                                       if (dl->size() >= maxentries)
+                                       {
+                                               user->WriteNumeric(996, "%s :Too many nicks on DCCALLOW list", user->nick.c_str());
+                                               return CMD_FAILURE;
+                                       }
+
                                        for (dccallowlist::const_iterator k = dl->begin(); k != dl->end(); ++k)
                                        {
                                                if (k->nickname == target->nick)
@@ -453,6 +460,9 @@ class ModuleDCCAllow : public Module
 
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
+               ConfigTag* tag = ServerInstance->Config->ConfValue("dccallow");
+               cmd.maxentries = tag->getInt("maxentries", 20);
+
                bfl.clear();
                ConfigTagList tags = ServerInstance->Config->ConfTags("banfile");
                for (ConfigIter i = tags.first; i != tags.second; ++i)