]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove MaxWhoResults, replace with an increase of Penalty based on result list size
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 29 Jan 2010 00:08:45 +0000 (00:08 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 29 Jan 2010 00:08:45 +0000 (00:08 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12325 e03df62e-2008-0410-955e-edbf42e46eb7

include/configreader.h
src/commands/cmd_who.cpp
src/configreader.cpp

index eee16cb6c46c6794579e0d37ba62b87cdc136a4c..3d01d7e9168ec01ec7a41e653cff71cf6b4971c6 100644 (file)
@@ -409,11 +409,6 @@ class CoreExport ServerConfig
         */
        unsigned int MaxTargets;
 
-       /** The maximum number of /WHO results allowed
-        * in any single /WHO command.
-        */
-       int MaxWhoResults;
-
        /** True if we're going to hide netsplits as *.net *.split for non-opers
         */
        bool HideSplits;
index 5c01d40fcc77dfeec412d10c21e13266d5c5f579..6aac6eeea2cb451a1e3139b7e3b1ea9ecff24ec1 100644 (file)
@@ -23,7 +23,6 @@ class CommandWho : public Command
        bool CanView(Channel* chan, User* user);
        bool opt_viewopersonly;
        bool opt_showrealhost;
-       bool opt_unlimit;
        bool opt_realname;
        bool opt_mode;
        bool opt_ident;
@@ -37,7 +36,9 @@ class CommandWho : public Command
  public:
        /** Constructor for who.
         */
-       CommandWho ( Module* parent) : Command(parent,"WHO", 1) { Penalty = 2; syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; }
+       CommandWho ( Module* parent) : Command(parent,"WHO", 1) {
+               syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]";
+       }
        void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults);
        /** Handle command.
         * @param parameters The parameters to the comamnd
@@ -228,7 +229,6 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
        /* WHO options */
        opt_viewopersonly = false;
        opt_showrealhost = false;
-       opt_unlimit = false;
        opt_realname = false;
        opt_mode = false;
        opt_ident = false;
@@ -277,10 +277,6 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                                        if (user->HasPrivPermission("users/auspex"))
                                                opt_showrealhost = true;
                                        break;
-                               case 'u':
-                                       if (user->HasPrivPermission("users/auspex"))
-                                               opt_unlimit = true;
-                                       break;
                                case 'r':
                                        opt_realname = true;
                                        break;
@@ -388,19 +384,15 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                }
        }
        /* Send the results out */
-       if ((ServerInstance->Config->MaxWhoResults && (whoresults.size() <= (size_t)ServerInstance->Config->MaxWhoResults)) || opt_unlimit)
-       {
-               for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
-                       user->WriteServ(*n);
-               user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick.c_str(), *parameters[0].c_str() ? parameters[0].c_str() : "*");
-               return CMD_SUCCESS;
-       }
-       else
-       {
-               /* BZZT! Too many results. */
-               user->WriteNumeric(315, "%s %s :Too many results",user->nick.c_str(), parameters[0].c_str());
-               return CMD_FAILURE;
-       }
+       for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
+               user->WriteServ(*n);
+       user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick.c_str(), *parameters[0].c_str() ? parameters[0].c_str() : "*");
+
+       // Penalize the user a bit for large queries
+       // (add one unit of penalty per 200 results)
+       if (IS_LOCAL(user))
+               IS_LOCAL(user)->CommandFloodPenalty += whoresults.size() * 5;
+       return CMD_SUCCESS;
 }
 
 COMMAND_INIT(CommandWho)
index 6057420c84ead17b7e03f441f573bc231d116a16..04763cbaba49c156701e2bca79f64303103c74d0 100644 (file)
@@ -42,7 +42,6 @@ ServerConfig::ServerConfig()
        NetBufferSize = 10240;
        SoftLimit = ServerInstance->SE->GetMaxFds();
        MaxConn = SOMAXCONN;
-       MaxWhoResults = 0;
        MaxChans = 20;
        OperMaxChans = 30;
        c_ipv4_range = 32;
@@ -452,7 +451,6 @@ void ServerConfig::Fill()
        AdminNick = ConfValue("admin")->getString("nick", "admin");
        ModPath = ConfValue("path")->getString("moduledir", MOD_PATH);
        NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240);
-       MaxWhoResults = ConfValue("performance")->getInt("maxwho", 1024);
        dns_timeout = ConfValue("dns")->getInt("timeout", 5);
        DisabledCommands = ConfValue("disabled")->getString("commands", "");
        DisabledDontExist = ConfValue("disabled")->getBool("fakenonexistant");
@@ -496,7 +494,6 @@ void ServerConfig::Fill()
        range(MaxConn, 0, SOMAXCONN, SOMAXCONN, "<performance:somaxconn>");
        range(MaxTargets, 1, 31, 20, "<security:maxtargets>");
        range(NetBufferSize, 1024, 65534, 10240, "<performance:netbuffersize>");
-       range(MaxWhoResults, 1, 65535, 1024, "<performace:maxwho>");
        range(WhoWasGroupSize, 0, 10000, 10, "<whowas:groupsize>");
        range(WhoWasMaxGroups, 0, 1000000, 10240, "<whowas:maxgroups>");
        range(WhoWasMaxKeep, 3600, INT_MAX, 3600, "<whowas:maxkeep>");