summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-08-28 19:45:21 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-08-28 19:45:21 +0000
commit0a3159121e15decec9bcb82c836158a817bba894 (patch)
tree778ed6bfd9a92c5ff2a12e830c8ec450c2057ac4 /src
parented1dd51ef7fbf396ecfa77350b67ed8a4c0be29c (diff)
Rename lowermap to rfc_case_insensitive_map, add case_sensitive_map.. adjust files to not pass lowermap directly.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10337 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp8
-rw-r--r--src/commands/cmd_list.cpp2
-rw-r--r--src/commands/cmd_rehash.cpp2
-rw-r--r--src/commands/cmd_who.cpp14
-rw-r--r--src/hashcomp.cpp26
-rw-r--r--src/wildcard.cpp2
-rw-r--r--src/xline.cpp32
7 files changed, 43 insertions, 43 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 68ad224ae..62029bd65 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -32,8 +32,8 @@ bool InspIRCd::HostMatchesEveryone(const std::string &mask, User* user)
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if ((InspIRCd::Match(u->second->MakeHost(), mask, lowermap)) ||
- (InspIRCd::Match(u->second->MakeHostIP(), mask, lowermap)))
+ if ((InspIRCd::Match(u->second->MakeHost(), mask)) ||
+ (InspIRCd::Match(u->second->MakeHostIP(), mask)))
{
matches++;
}
@@ -64,7 +64,7 @@ bool InspIRCd::IPMatchesEveryone(const std::string &ip, User* user)
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if (InspIRCd::Match(u->second->GetIPString(), ip, lowermap))
+ if (InspIRCd::Match(u->second->GetIPString(), ip))
matches++;
}
@@ -93,7 +93,7 @@ bool InspIRCd::NickMatchesEveryone(const std::string &nick, User* user)
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if (InspIRCd::Match(u->second->nick, nick, lowermap))
+ if (InspIRCd::Match(u->second->nick, nick))
matches++;
}
diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp
index d4abfd437..900946eaf 100644
--- a/src/commands/cmd_list.cpp
+++ b/src/commands/cmd_list.cpp
@@ -53,7 +53,7 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
if (parameters.size() && (parameters[0][0] != '<' || parameters[0][0] == '>'))
{
- if (!InspIRCd::Match(i->second->name, parameters[0], lowermap) && !InspIRCd::Match(i->second->topic, parameters[0], lowermap))
+ if (!InspIRCd::Match(i->second->name, parameters[0]) && !InspIRCd::Match(i->second->topic, parameters[0]))
continue;
}
diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp
index 28ae32a0d..9a9384af5 100644
--- a/src/commands/cmd_rehash.cpp
+++ b/src/commands/cmd_rehash.cpp
@@ -28,7 +28,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use
if (parameters.size() && parameters[0][0] != '-')
{
- if (!InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0], lowermap))
+ if (!InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0]))
{
FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
return CMD_SUCCESS; // rehash for a server, and not for us
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index 1ce4e4c28..403ec5f64 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -71,11 +71,11 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
if (opt_metadata)
match = user->GetExt(matchtext, dummy);
else if (opt_realname)
- match = InspIRCd::Match(user->fullname, matchtext, lowermap);
+ match = InspIRCd::Match(user->fullname, matchtext);
else if (opt_showrealhost)
- match = InspIRCd::Match(user->host, matchtext, lowermap);
+ match = InspIRCd::Match(user->host, matchtext);
else if (opt_ident)
- match = InspIRCd::Match(user->ident, matchtext, lowermap);
+ match = InspIRCd::Match(user->ident, matchtext);
else if (opt_port)
{
irc::portparser portrange(matchtext, false);
@@ -88,7 +88,7 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
}
}
else if (opt_away)
- match = InspIRCd::Match(user->awaymsg, matchtext, lowermap);
+ match = InspIRCd::Match(user->awaymsg, matchtext);
else if (opt_time)
{
long seconds = ServerInstance->Duration(matchtext);
@@ -106,13 +106,13 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
* -- w00t
*/
if (!match)
- match = InspIRCd::Match(user->dhost, matchtext, lowermap);
+ match = InspIRCd::Match(user->dhost, matchtext);
if (!match)
- match = InspIRCd::Match(user->nick, matchtext, lowermap);
+ match = InspIRCd::Match(user->nick, matchtext);
if (!match)
- match = InspIRCd::Match(user->server, matchtext, lowermap);
+ match = InspIRCd::Match(user->server, matchtext);
return match;
}
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index f98446ba6..a9a3441b9 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -56,7 +56,7 @@ void nspace::strlower(char *n)
if (n)
{
for (char* t = n; *t; t++)
- *t = lowermap[(unsigned char)*t];
+ *t = rfc_case_insensitive_map[(unsigned char)*t];
}
}
@@ -73,12 +73,12 @@ void nspace::strlower(char *n)
/* XXX: NO DATA COPIES! :)
* The hash function here is practically
* a copy of the one in STL's hash_fun.h,
- * only with *x replaced with lowermap[*x].
+ * only with *x replaced with rfc_case_insensitive_map[*x].
* This avoids a copy to use hash<const char*>
*/
register size_t t = 0;
for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
- t = 5 * t + lowermap[(unsigned char)*x];
+ t = 5 * t + rfc_case_insensitive_map[(unsigned char)*x];
return t;
}
@@ -91,7 +91,7 @@ size_t nspace::hash_compare<irc::string, std::less<irc::string> >::operator()(co
{
register size_t t = 0;
for (irc::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
- t = 5 * t + lowermap[(unsigned char)*x];
+ t = 5 * t + rfc_case_insensitive_map[(unsigned char)*x];
return t;
}
@@ -100,9 +100,9 @@ bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2)
const unsigned char* n1 = (const unsigned char*)s1.c_str();
const unsigned char* n2 = (const unsigned char*)s2.c_str();
for (; *n1 && *n2; n1++, n2++)
- if (lowermap[*n1] != lowermap[*n2])
+ if (rfc_case_insensitive_map[*n1] != rfc_case_insensitive_map[*n2])
return false;
- return (lowermap[*n1] == lowermap[*n2]);
+ return (rfc_case_insensitive_map[*n1] == rfc_case_insensitive_map[*n2]);
}
/******************************************************
@@ -112,33 +112,33 @@ bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2)
* std::string which is not only case-insensitive but
* can also do scandanavian comparisons, e.g. { = [, etc.
*
- * This class depends on the const array 'lowermap'.
+ * This class depends on the const array 'rfc_case_insensitive_map'.
*
******************************************************/
bool irc::irc_char_traits::eq(char c1st, char c2nd)
{
- return lowermap[(unsigned char)c1st] == lowermap[(unsigned char)c2nd];
+ return rfc_case_insensitive_map[(unsigned char)c1st] == rfc_case_insensitive_map[(unsigned char)c2nd];
}
bool irc::irc_char_traits::ne(char c1st, char c2nd)
{
- return lowermap[(unsigned char)c1st] != lowermap[(unsigned char)c2nd];
+ return rfc_case_insensitive_map[(unsigned char)c1st] != rfc_case_insensitive_map[(unsigned char)c2nd];
}
bool irc::irc_char_traits::lt(char c1st, char c2nd)
{
- return lowermap[(unsigned char)c1st] < lowermap[(unsigned char)c2nd];
+ return rfc_case_insensitive_map[(unsigned char)c1st] < rfc_case_insensitive_map[(unsigned char)c2nd];
}
int irc::irc_char_traits::compare(const char* str1, const char* str2, size_t n)
{
for(unsigned int i = 0; i < n; i++)
{
- if(lowermap[(unsigned char)*str1] > lowermap[(unsigned char)*str2])
+ if(rfc_case_insensitive_map[(unsigned char)*str1] > rfc_case_insensitive_map[(unsigned char)*str2])
return 1;
- if(lowermap[(unsigned char)*str1] < lowermap[(unsigned char)*str2])
+ if(rfc_case_insensitive_map[(unsigned char)*str1] < rfc_case_insensitive_map[(unsigned char)*str2])
return -1;
if(*str1 == 0 || *str2 == 0)
@@ -152,7 +152,7 @@ int irc::irc_char_traits::compare(const char* str1, const char* str2, size_t n)
const char* irc::irc_char_traits::find(const char* s1, int n, char c)
{
- while(n-- > 0 && lowermap[(unsigned char)*s1] != lowermap[(unsigned char)c])
+ while(n-- > 0 && rfc_case_insensitive_map[(unsigned char)*s1] != rfc_case_insensitive_map[(unsigned char)c])
s1++;
return s1;
}
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 270117b65..b49ba943a 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -40,7 +40,7 @@ static bool match_internal(const unsigned char *string, const unsigned char *wil
return false;
if (!map)
- map = lowermap;
+ map = rfc_case_insensitive_map;
while (*string)
{
diff --git a/src/xline.cpp b/src/xline.cpp
index 53493b59e..b74072bff 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -457,10 +457,10 @@ bool KLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask, NULL))
+ if (InspIRCd::Match(u->ident, this->identmask))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask, NULL) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, NULL))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
{
return true;
}
@@ -479,10 +479,10 @@ bool GLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask, NULL))
+ if (InspIRCd::Match(u->ident, this->identmask))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask, NULL) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, NULL))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
{
return true;
}
@@ -501,10 +501,10 @@ bool ELine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask, NULL))
+ if (InspIRCd::Match(u->ident, this->identmask))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask, NULL) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, NULL))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
{
return true;
}
@@ -518,7 +518,7 @@ bool ZLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::MatchCIDR(u->GetIPString(), this->ipaddr, NULL))
+ if (InspIRCd::MatchCIDR(u->GetIPString(), this->ipaddr))
return true;
else
return false;
@@ -535,7 +535,7 @@ bool QLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->nick, this->nick, lowermap))
+ if (InspIRCd::Match(u->nick, this->nick))
return true;
return false;
@@ -550,7 +550,7 @@ void QLine::Apply(User* u)
bool ZLine::Matches(const std::string &str)
{
- if (InspIRCd::MatchCIDR(str, this->ipaddr, NULL))
+ if (InspIRCd::MatchCIDR(str, this->ipaddr))
return true;
else
return false;
@@ -558,7 +558,7 @@ bool ZLine::Matches(const std::string &str)
bool QLine::Matches(const std::string &str)
{
- if (InspIRCd::Match(str, this->nick, lowermap))
+ if (InspIRCd::Match(str, this->nick))
return true;
return false;
@@ -566,17 +566,17 @@ bool QLine::Matches(const std::string &str)
bool ELine::Matches(const std::string &str)
{
- return (InspIRCd::MatchCIDR(str, matchtext, NULL));
+ return (InspIRCd::MatchCIDR(str, matchtext));
}
bool KLine::Matches(const std::string &str)
{
- return (InspIRCd::MatchCIDR(str.c_str(), matchtext, NULL));
+ return (InspIRCd::MatchCIDR(str.c_str(), matchtext));
}
bool GLine::Matches(const std::string &str)
{
- return (InspIRCd::MatchCIDR(str, matchtext, NULL));
+ return (InspIRCd::MatchCIDR(str, matchtext));
}
void ELine::OnAdd()