diff options
author | Peter Powell <petpow@saberuk.com> | 2013-05-18 18:55:01 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-05-18 19:11:07 +0100 |
commit | 5c9427cde0a949a17a476311db0a2a275345337b (patch) | |
tree | bf4cea76e7270f476d3f19ec82db9885db9574c1 /src | |
parent | 6153822a2de1867b7b90b95e8ed9bc1a8c792c84 (diff) |
Remove the size argument from IsChannel and IsNick.
There was only one case (which was probably an error) where these
methods were not set to their ServerLimits value.
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_join.cpp | 4 | ||||
-rw-r--r-- | src/commands/cmd_nick.cpp | 2 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_banredirect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_channames.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_conn_join.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_denychans.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_nationalchars.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_nicklock.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_ojoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operjoin.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_redirect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sajoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sanick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/svsjoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 4 |
16 files changed, 33 insertions, 33 deletions
diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp index da2ec1b45..a88509bc2 100644 --- a/src/commands/cmd_join.cpp +++ b/src/commands/cmd_join.cpp @@ -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; diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index 4c26d947f..e58aab986 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -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; diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 8a74a64e4..d11a13aa0 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -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) diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 5e042ad79..332e625e0 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -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; diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index f1704a528..9b43649a8 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -23,17 +23,17 @@ 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(); diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index c49afbdfc..bfac8147d 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -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); } } diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 63f6f51b9..b09ee7977 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -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); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index e39a41815..4e921957a 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -31,12 +31,12 @@ /* $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); } } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index a6178fc5a..8e0d5ae7f 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -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; diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index c99e24b0f..35d90b23e 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -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; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index faeeb8b55..e890c3afb 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -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); } diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 2ce213958..000d53a2e 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -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(); diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 2724a1ce3..205cd6569 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -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"); diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 4ba420367..01899dd0a 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -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; diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index 6b1d2835c..032633416 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -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 diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 1a0594637..712699775 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -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; |