summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helperfuncs.cpp32
-rw-r--r--src/modules.cpp36
2 files changed, 32 insertions, 36 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index ceb4711a9..388e9bb50 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -391,6 +391,38 @@ long InspIRCd::LocalUserCount()
return (local_users.size() - this->UnregisteredUserCount());
}
+bool InspIRCd::IsValidMask(const std::string &mask)
+{
+ char* dest = (char*)mask.c_str();
+ int exclamation = 0;
+ int atsign = 0;
+
+ for (char* i = dest; *i; i++)
+ {
+ /* out of range character, bad mask */
+ if (*i < 32 || *i > 126)
+ {
+ return false;
+ }
+
+ switch (*i)
+ {
+ case '!':
+ exclamation++;
+ break;
+ case '@':
+ atsign++;
+ break;
+ }
+ }
+
+ /* valid masks only have 1 ! and @ */
+ if (exclamation != 1 || atsign != 1)
+ return false;
+
+ return true;
+}
+
/* true for valid channel name, false else */
bool InspIRCd::IsChannel(const char *chname)
{
diff --git a/src/modules.cpp b/src/modules.cpp
index 8da123b05..5639f3088 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -901,42 +901,6 @@ bool InspIRCd::DelELine(const std::string &hostmask)
return XLines->del_eline(hostmask.c_str());
}
-/*
- * XXX why on *earth* is this in modules.cpp...? I think
- * perhaps we need a server.cpp for InspIRCd:: stuff where possible. -- w00t
- */
-bool InspIRCd::IsValidMask(const std::string &mask)
-{
- char* dest = (char*)mask.c_str();
- int exclamation = 0;
- int atsign = 0;
-
- for (char* i = dest; *i; i++)
- {
- /* out of range character, bad mask */
- if (*i < 32 || *i > 126)
- {
- return false;
- }
-
- switch (*i)
- {
- case '!':
- exclamation++;
- break;
- case '@':
- atsign++;
- break;
- }
- }
-
- /* valid masks only have 1 ! and @ */
- if (exclamation != 1 || atsign != 1)
- return false;
-
- return true;
-}
-
Module* ModuleManager::Find(const std::string &name)
{
for (int i = 0; i <= this->GetCount(); i++)