]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove the size argument from IsChannel and IsNick.
authorPeter Powell <petpow@saberuk.com>
Sat, 18 May 2013 17:55:01 +0000 (18:55 +0100)
committerPeter Powell <petpow@saberuk.com>
Sat, 18 May 2013 18:11:07 +0000 (19:11 +0100)
There was only one case (which was probably an error) where these
methods were not set to their ServerLimits value.

17 files changed:
include/inspircd.h
src/commands/cmd_join.cpp
src/commands/cmd_nick.cpp
src/helperfuncs.cpp
src/modules/m_banredirect.cpp
src/modules/m_channames.cpp
src/modules/m_conn_join.cpp
src/modules/m_denychans.cpp
src/modules/m_nationalchars.cpp
src/modules/m_nicklock.cpp
src/modules/m_ojoin.cpp
src/modules/m_operjoin.cpp
src/modules/m_redirect.cpp
src/modules/m_sajoin.cpp
src/modules/m_sanick.cpp
src/modules/m_spanningtree/svsjoin.cpp
src/modules/m_watch.cpp

index 04327992c39252d97bd9210096c30baba83836f3..ed6f7df94fa3284517e6fa66f6dae9a0b236ddf9 100644 (file)
@@ -246,10 +246,10 @@ public:
        void SendTo(LocalUser* user);
 };
 
-DEFINE_HANDLER2(IsNickHandler, bool, const std::string&, size_t);
+DEFINE_HANDLER1(IsNickHandler, bool, const std::string&);
 DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t);
 DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&);
-DEFINE_HANDLER2(IsChannelHandler, bool, const std::string&, size_t);
+DEFINE_HANDLER1(IsChannelHandler, bool, const std::string&);
 DEFINE_HANDLER1(RehashHandler, void, const std::string&);
 DEFINE_HANDLER3(OnCheckExemptionHandler, ModResult, User*, Channel*, const std::string&);
 
@@ -509,7 +509,7 @@ class CoreExport InspIRCd
         * @param chname A channel name to verify
         * @return True if the name is valid
         */
-       caller2<bool, const std::string&, size_t> IsChannel;
+       caller1<bool, const std::string&> IsChannel;
 
        /** Return true if str looks like a server ID
         * @param string to check against
@@ -565,7 +565,7 @@ class CoreExport InspIRCd
         * @param n A nickname to verify
         * @return True if the nick is valid
         */
-       caller2<bool, const std::string&, size_t> IsNick;
+       caller1<bool, const std::string&> IsNick;
 
        /** Return true if an ident is valid
         * @param An ident to verify
index da2ec1b4576fbf4654b474ab88256f7245fadfac..a88509bc26c00314f5a500c083facb4f8ba6199d 100644 (file)
@@ -55,7 +55,7 @@ CmdResult CommandJoin::HandleLocal(const std::vector<std::string>& parameters, L
                if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, 1, false))
                        return CMD_SUCCESS;
 
-               if (ServerInstance->IsChannel(parameters[0], ServerInstance->Config->Limits.ChanMax))
+               if (ServerInstance->IsChannel(parameters[0]))
                {
                        Channel::JoinUser(user, parameters[0], false, parameters[1]);
                        return CMD_SUCCESS;
@@ -66,7 +66,7 @@ CmdResult CommandJoin::HandleLocal(const std::vector<std::string>& parameters, L
                if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, -1, false))
                        return CMD_SUCCESS;
 
-               if (ServerInstance->IsChannel(parameters[0], ServerInstance->Config->Limits.ChanMax))
+               if (ServerInstance->IsChannel(parameters[0]))
                {
                        Channel::JoinUser(user, parameters[0]);
                        return CMD_SUCCESS;
index 4c26d947fb223262c242de3ac80b5ee78fb1cfa3..e58aab98693e5645f0757de23d3bc2220e8dbc48 100644 (file)
@@ -66,7 +66,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
        {
                newnick = user->uuid;
        }
-       else if (!ServerInstance->IsNick(newnick, ServerInstance->Config->Limits.NickMax))
+       else if (!ServerInstance->IsNick(newnick))
        {
                user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick.c_str(),newnick.c_str());
                return CMD_FAILURE;
index 8a74a64e49898f37c6b62646ca0f58bdeb0d426a..d11a13aa0f57e78133aa09b70e47a00eb9f9b774 100644 (file)
@@ -242,9 +242,9 @@ void InspIRCd::ProcessColors(file_cache& input)
 }
 
 /* true for valid channel name, false else */
-bool IsChannelHandler::Call(const std::string& chname, size_t max)
+bool IsChannelHandler::Call(const std::string& chname)
 {
-       if (chname.empty() || chname.length() > max)
+       if (chname.empty() || chname.length() > ServerInstance->Config->Limits.ChanMax)
                return false;
 
        if (chname[0] != '#')
@@ -265,9 +265,9 @@ bool IsChannelHandler::Call(const std::string& chname, size_t max)
 }
 
 /* true for valid nickname, false else */
-bool IsNickHandler::Call(const std::string& n, size_t max)
+bool IsNickHandler::Call(const std::string& n)
 {
-       if (n.empty() || n.length() > max)
+       if (n.empty() || n.length() > ServerInstance->Config->Limits.NickMax)
                return false;
 
        for (std::string::const_iterator i = n.begin(); i != n.end(); ++i)
index 5e042ad7918e0b6c8d0eb5d5d88234e40d8063de..332e625e0c50dd3e4a6a5cd27e5f550f05d9b05c 100644 (file)
@@ -137,7 +137,7 @@ class BanRedirect : public ModeWatcher
                        {
                                if (adding && IS_LOCAL(source))
                                {
-                                       if (!ServerInstance->IsChannel(mask[CHAN].c_str(),  ServerInstance->Config->Limits.ChanMax))
+                                       if (!ServerInstance->IsChannel(mask[CHAN]))
                                        {
                                                source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick.c_str(), channel->name.c_str(), mask[CHAN].c_str());
                                                return false;
index f1704a52891ab6a0d13daf0aefb2b5b745875011..9b43649a815e5db24cc21722d98d6672adc1ecf5 100644 (file)
 
 static std::bitset<256> allowedmap;
 
-class NewIsChannelHandler : public HandlerBase2<bool, const std::string&, size_t>
+class NewIsChannelHandler : public HandlerBase1<bool, const std::string&>
 {
  public:
        NewIsChannelHandler() { }
        ~NewIsChannelHandler() { }
-       bool Call(const std::string&, size_t);
+       bool Call(const std::string&);
 };
 
-bool NewIsChannelHandler::Call(const std::string& channame, size_t max)
+bool NewIsChannelHandler::Call(const std::string& channame)
 {
-       if (channame.empty() || channame.length() > max || channame[0] != '#')
+       if (channame.empty() || channame.length() > ServerInstance->Config->Limits.ChanMax || channame[0] != '#')
                return false;
 
        for (std::string::const_iterator c = channame.begin(); c != channame.end(); ++c)
@@ -49,7 +49,7 @@ bool NewIsChannelHandler::Call(const std::string& channame, size_t max)
 class ModuleChannelNames : public Module
 {
        NewIsChannelHandler myhandler;
-       caller2<bool, const std::string&, size_t> rememberer;
+       caller1<bool, const std::string&> rememberer;
        bool badchan;
 
  public:
@@ -71,7 +71,7 @@ class ModuleChannelNames : public Module
                std::vector<Channel*> chanvec;
                for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); ++i)
                {
-                       if (!ServerInstance->IsChannel(i->second->name, MAXBUF))
+                       if (!ServerInstance->IsChannel(i->second->name))
                                chanvec.push_back(i->second);
                }
                std::vector<Channel*>::reverse_iterator c2 = chanvec.rbegin();
index c49afbdfcae8681700b4cf2b4cee94727e72b77e..bfac8147d76e2f66db164b3ef6af90078911cecc 100644 (file)
@@ -57,7 +57,7 @@ class ModuleConnJoin : public Module
 
                        while (chans.GetToken(chan))
                        {
-                               if (ServerInstance->IsChannel(chan, ServerInstance->Config->Limits.ChanMax))
+                               if (ServerInstance->IsChannel(chan))
                                        Channel::JoinUser(localuser, chan);
                        }
                }
index 63f6f51b9da2ac893c72a9374afc3cc6073c06b4..b09ee7977d24d65a199db45debaef82bc988be7a 100644 (file)
@@ -45,7 +45,7 @@ class ModuleDenyChannels : public Module
                        if (!redirect.empty())
                        {
 
-                               if (!ServerInstance->IsChannel(redirect, ServerInstance->Config->Limits.ChanMax))
+                               if (!ServerInstance->IsChannel(redirect))
                                {
                                        if (user)
                                                user->WriteNotice("Invalid badchan redirect '" + redirect + "'");
@@ -108,7 +108,7 @@ class ModuleDenyChannels : public Module
                                                }
                                        }
 
-                                       if (ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax))
+                                       if (ServerInstance->IsChannel(redirect))
                                        {
                                                /* simple way to avoid potential loops: don't redirect to +L channels */
                                                Channel *newchan = ServerInstance->FindChan(redirect);
index e39a418159b7cd2d414c2dc0739d38cbfb80d084..4e921957a338abef8a732da5ca1c2fb9b53bc579 100644 (file)
 
 /* $ModDesc: Provides an ability to have non-RFC1459 nicks & support for national CASEMAPPING */
 
-class lwbNickHandler : public HandlerBase2<bool, const std::string&, size_t>
+class lwbNickHandler : public HandlerBase1<bool, const std::string&>
 {
  public:
        lwbNickHandler() { }
        ~lwbNickHandler() { }
-       bool Call(const std::string&, size_t);
+       bool Call(const std::string&);
 };
 
                                                                 /*,m_reverse_additionalUp[256];*/
@@ -71,7 +71,7 @@ char utf8size(unsigned char * mb)
 
 
 /* Conditions added */
-bool lwbNickHandler::Call(const std::string& nick, size_t max)
+bool lwbNickHandler::Call(const std::string& nick)
 {
        if (nick.empty())
                return false;
@@ -216,7 +216,7 @@ bool lwbNickHandler::Call(const std::string& nick, size_t max)
        }
 
        /* too long? or not -- pointer arithmetic rocks */
-       return (p < max);
+       return (p < ServerInstance->Config->Limits.NickMax);
 }
 
 
@@ -225,7 +225,7 @@ class ModuleNationalChars : public Module
        lwbNickHandler myhandler;
        std::string charset, casemapping;
        unsigned char m_additional[256], m_additionalUp[256], m_lower[256], m_upper[256];
-       caller2<bool, const std::string&, size_t> rememberer;
+       caller1<bool, const std::string&> rememberer;
        bool forcequit;
        const unsigned char * lowermap_rememberer;
 
@@ -274,7 +274,7 @@ class ModuleNationalChars : public Module
                {
                        /* Fix by Brain: Dont quit UID users */
                        User* n = *iter;
-                       if (!isdigit(n->nick[0]) && !ServerInstance->IsNick(n->nick, ServerInstance->Config->Limits.NickMax))
+                       if (!isdigit(n->nick[0]) && !ServerInstance->IsNick(n->nick))
                                ServerInstance->Users->QuitUser(n, message);
                }
        }
index a6178fc5a9fd61ca881461ee09551ad284ce532d..8e0d5ae7f0da0a5b26a86132f060f121d35e1e23 100644 (file)
@@ -51,7 +51,7 @@ class CommandNicklock : public Command
                /* Do local sanity checks and bails */
                if (IS_LOCAL(user))
                {
-                       if (!ServerInstance->IsNick(parameters[1], ServerInstance->Config->Limits.NickMax))
+                       if (!ServerInstance->IsNick(parameters[1]))
                        {
                                user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
                                return CMD_FAILURE;
index c99e24b0f953a98c9b953ab9c8df16acc30975f3..35d90b23e9c2b1903180d1dbe2cb54761a62a327 100644 (file)
@@ -60,7 +60,7 @@ class CommandOjoin : public SplitCommand
        CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user)
        {
                // Make sure the channel name is allowable.
-               if (!ServerInstance->IsChannel(parameters[0], ServerInstance->Config->Limits.ChanMax))
+               if (!ServerInstance->IsChannel(parameters[0]))
                {
                        user->WriteNotice("*** Invalid characters in channel name or name too long");
                        return CMD_FAILURE;
index faeeb8b55c8b64d9ef43b9b993b8cdcc6020a01c..e890c3afb709ad36d627165a6d35c8ee0aa19e09 100644 (file)
@@ -83,7 +83,7 @@ class ModuleOperjoin : public Module
                                return;
 
                        for (std::vector<std::string>::const_iterator i = operChans.begin(); i != operChans.end(); ++i)
-                               if (ServerInstance->IsChannel(*i, ServerInstance->Config->Limits.ChanMax))
+                               if (ServerInstance->IsChannel(*i))
                                        Channel::JoinUser(localuser, *i, override);
 
                        std::string chanList = localuser->oper->getConfig("autojoin");
@@ -93,7 +93,7 @@ class ModuleOperjoin : public Module
                                tokenize(chanList, typechans);
                                for (std::vector<std::string>::const_iterator it = typechans.begin(); it != typechans.end(); ++it)
                                {
-                                       if (ServerInstance->IsChannel(*it, ServerInstance->Config->Limits.ChanMax))
+                                       if (ServerInstance->IsChannel(*it))
                                        {
                                                Channel::JoinUser(localuser, *it, override);
                                        }
index 2ce213958f14c604777ca21e233135f18d10326b..000d53a2e21055d5aa57a57dbc5bb91ebf9e242e 100644 (file)
@@ -39,7 +39,7 @@ class Redirect : public ModeHandler
                {
                        if (IS_LOCAL(source))
                        {
-                               if (!ServerInstance->IsChannel(parameter, ServerInstance->Config->Limits.ChanMax))
+                               if (!ServerInstance->IsChannel(parameter))
                                {
                                        source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
                                        parameter.clear();
index 2724a1ce30b9c1ca9549f45a369ca95f7cc6b218..205cd656976c7e3ee331bd99331fe26113184c56 100644 (file)
@@ -45,7 +45,7 @@ class CommandSajoin : public Command
                                user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
                                return CMD_FAILURE;
                        }
-                       if (IS_LOCAL(user) && !ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
+                       if (IS_LOCAL(user) && !ServerInstance->IsChannel(parameters[1]))
                        {
                                /* we didn't need to check this for each character ;) */
                                user->WriteNotice("*** Invalid characters in channel name or name too long");
index 4ba42036738091aabb1378d65aae1f8cc9d30190..01899dd0add2b31e746c451b1313287898080162 100644 (file)
@@ -54,7 +54,7 @@ class CommandSanick : public Command
                                return CMD_FAILURE;
                        }
 
-                       if (!ServerInstance->IsNick(parameters[1], ServerInstance->Config->Limits.NickMax))
+                       if (!ServerInstance->IsNick(parameters[1]))
                        {
                                user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
                                return CMD_FAILURE;
index 6b1d2835cbb1e88b6f69486415791e0d34217bd3..032633416851e0dd4a5a71d0f84911985ce4cbcd 100644 (file)
@@ -25,7 +25,7 @@
 CmdResult CommandSVSJoin::Handle(const std::vector<std::string>& parameters, User *user)
 {
        // Check for valid channel name
-       if (!ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
+       if (!ServerInstance->IsChannel(parameters[1]))
                return CMD_FAILURE;
 
        // Check target exists
index 1a05946373bc07b5618809fbbd93aa92cc42cbc9..712699775e318396bfa23d1eb547f56ecede8f23 100644 (file)
@@ -146,7 +146,7 @@ class CommandWatch : public Command
        CmdResult remove_watch(User* user, const char* nick)
        {
                // removing an item from the list
-               if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
+               if (!ServerInstance->IsNick(nick))
                {
                        user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick.c_str(), nick);
                        return CMD_FAILURE;
@@ -196,7 +196,7 @@ class CommandWatch : public Command
 
        CmdResult add_watch(User* user, const char* nick)
        {
-               if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
+               if (!ServerInstance->IsNick(nick))
                {
                        user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick.c_str(),nick);
                        return CMD_FAILURE;