summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-07 18:31:57 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-07 18:31:57 +0000
commit805d47c98e48df374976972c3fcbba36fd4289f8 (patch)
treed55b8cf542010770881bef33e269f6ce62e4b394 /src
parent6c389362435138c1523e4aedb53938100f6b4c47 (diff)
Move stuff to use ASCII map where required.
Also move this out of being a member totally, as it breaks (gah) and is already untidy.. to be revisited. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10858 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cidr.cpp2
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/commands.cpp4
-rw-r--r--src/inspircd.cpp9
-rw-r--r--src/modules.cpp2
-rw-r--r--src/wildcard.cpp8
-rw-r--r--src/xline.cpp18
7 files changed, 26 insertions, 19 deletions
diff --git a/src/cidr.cpp b/src/cidr.cpp
index 91f4d0237..669ccd8d2 100644
--- a/src/cidr.cpp
+++ b/src/cidr.cpp
@@ -90,7 +90,7 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr
* symbols, and recursively call MatchCIDR without
* username matching enabled to match the host part.
*/
- return (InspIRCd::Match(address.substr(0, username_addr_pos), cidr_mask.substr(0, username_mask_pos), NULL) &&
+ return (InspIRCd::Match(address.substr(0, username_addr_pos), cidr_mask.substr(0, username_mask_pos), ascii_case_insensitive_map) &&
MatchCIDR(address.substr(username_addr_pos + 1), cidr_mask.substr(username_mask_pos + 1), false));
}
else
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 8798f03f0..eeb4b3e9f 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -578,7 +578,7 @@ void CommandParser::SetupCommandTable()
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (InspIRCd::Match(entry->d_name, "cmd_*.so"))
+ if (InspIRCd::Match(entry->d_name, "cmd_*.so", ascii_case_insensitive_map))
{
printf(".");
fflush(stdout);
diff --git a/src/commands.cpp b/src/commands.cpp
index 7efcefc6d..364f06004 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)) ||
- (InspIRCd::Match(u->second->MakeHostIP(), mask)))
+ if ((InspIRCd::Match(u->second->MakeHost(), mask, ascii_case_insensitive_map)) ||
+ (InspIRCd::Match(u->second->MakeHostIP(), mask, ascii_case_insensitive_map)))
{
matches++;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index dd772f94e..be88f3ae1 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -54,6 +54,14 @@
InspIRCd* SI = NULL;
int* mysig = NULL;
+/** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
+ * if it must.
+ *
+ * This is provided as a pointer so that modules can change it to their custom mapping tables,
+ * e.g. for national character support.
+ */
+unsigned const char *national_case_sensitive_map = rfc_case_insensitive_map;
+
/* Moved from exitcodes.h -- due to duplicate symbols -- Burlex
* XXX this is a bit ugly. -- w00t
@@ -985,7 +993,6 @@ void InspIRCd::SetSignal(int signal)
*/
ENTRYPOINT
{
- InspIRCd::national_case_sensitive_map = rfc_case_insensitive_map;
SI = new InspIRCd(argc, argv);
mysig = &SI->s_signal;
SI->Run();
diff --git a/src/modules.cpp b/src/modules.cpp
index 694601df9..0ea446c80 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -376,7 +376,7 @@ bool ModuleManager::Load(const char* filename)
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (InspIRCd::Match(entry->d_name, filename, NULL))
+ if (InspIRCd::Match(entry->d_name, filename, ascii_case_insensitive_map))
{
if (!this->Load(entry->d_name))
n_match++;
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 9f91d9c68..d34430c02 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -73,7 +73,7 @@ static bool match_internal(const unsigned char *str, const unsigned char *mask,
CoreExport bool InspIRCd::Match(const std::string &str, const std::string &mask, unsigned const char *map)
{
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
return match_internal((const unsigned char *)str.c_str(), (const unsigned char *)mask.c_str(), map);
}
@@ -81,7 +81,7 @@ CoreExport bool InspIRCd::Match(const std::string &str, const std::string &mask,
CoreExport bool InspIRCd::Match(const char *str, const char *mask, unsigned const char *map)
{
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
return match_internal((const unsigned char *)str, (const unsigned char *)mask, map);
}
@@ -91,7 +91,7 @@ CoreExport bool InspIRCd::MatchCIDR(const std::string &str, const std::string &m
return true;
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
// Fall back to regular match
return InspIRCd::Match(str, mask, map);
@@ -103,7 +103,7 @@ CoreExport bool InspIRCd::MatchCIDR(const char *str, const char *mask, unsigned
return true;
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
// Fall back to regular match
return InspIRCd::Match(str, mask, map);
diff --git a/src/xline.cpp b/src/xline.cpp
index 22086375d..02560a97b 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -466,10 +466,10 @@ bool KLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask))
+ if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
{
return true;
}
@@ -488,10 +488,10 @@ bool GLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask))
+ if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
{
return true;
}
@@ -510,10 +510,10 @@ bool ELine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask))
+ if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
{
return true;
}