diff options
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r-- | src/inspircd.cpp | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 96518fe56..14f88e0a3 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1,13 +1,13 @@ /* --------------------------------------------------------------------- * - * +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ + * +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * <brain@chatspike.net> - * <Craig@chatspike.net> + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. + * E-mail: + * <brain@chatspike.net> + * <Craig@chatspike.net> * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; you can redistribute @@ -51,7 +51,6 @@ #include "modules.h" #include "dynamic.h" #include "wildcard.h" -#include "message.h" #include "mode.h" #include "commands.h" #include "xline.h" @@ -889,6 +888,51 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) } } +bool InspIRCd::IsIdent(const char* n) +{ + if (!n || !*n) + return false; + + for (char* i = (char*)n; *i; i++) + { + if ((*i >= 'A') && (*i <= '}')) + { + continue; + } + if (((*i >= '0') && (*i <= '9')) || (*i == '-') || (*i == '.')) + { + continue; + } + return false; + } + return true; +} + + +bool InspIRCd::IsNick(const char* n) +{ + if (!n || !*n) + return false; + + int p = 0; + for (char* i = (char*)n; *i; i++, p++) + { + /* "A"-"}" can occur anywhere in a nickname */ + if ((*i >= 'A') && (*i <= '}')) + { + continue; + } + /* "0"-"9", "-" can occur anywhere BUT the first char of a nickname */ + if ((((*i >= '0') && (*i <= '9')) || (*i == '-')) && (i > n)) + { + continue; + } + /* invalid character! abort */ + return false; + } + return (p < NICKMAX - 1); +} + int InspIRCd::Run() { this->Res = new DNS(this); |