From 3b3cb845602bbaa3935f736785a53724750230dc Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 25 Nov 2017 12:29:05 +0000 Subject: Convert IsIdent to std::function. --- include/inspircd.h | 16 +++++++++------- src/helperfuncs.cpp | 2 +- src/inspircd.cpp | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index da86698a6..528092499 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -166,7 +166,6 @@ class serverstats }; DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t); -DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&); DEFINE_HANDLER1(IsChannelHandler, bool, const std::string&); /** The main class of the irc server. @@ -212,7 +211,6 @@ class CoreExport InspIRCd ActionList AtomicActions; /**** Functors ****/ - IsIdentHandler HandleIsIdent; IsChannelHandler HandleIsChannel; GenRandomHandler HandleGenRandom; @@ -424,11 +422,15 @@ class CoreExport InspIRCd */ static bool DefaultIsNick(const std::string& nick); - /** Return true if an ident is valid - * @param An ident to verify - * @return True if the ident is valid - */ - caller1 IsIdent; + /** Determines whether an ident is valid. */ + TR1NS::function IsIdent; + + /** Determines whether a ident is valid according to the RFC 1459 rules. + * This is the default function for InspIRCd::IsIdent. + * @param nick The ident to validate. + * @return True if the ident is valid according to RFC 1459 rules; otherwise, false. + */ + static bool DefaultIsIdent(const std::string& ident); /** Match two strings using pattern matching, optionally, with a map * to check case against (may be NULL). If map is null, match will be case insensitive. diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 5d4778b63..719454742 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -243,7 +243,7 @@ bool InspIRCd::DefaultIsNick(const std::string& n) } /* return true for good ident, false else */ -bool IsIdentHandler::Call(const std::string& n) +bool InspIRCd::DefaultIsIdent(const std::string& n) { if (n.empty()) return false; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 20001dbca..542789c7e 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -229,7 +229,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : GenRandom(&HandleGenRandom), IsChannel(&HandleIsChannel), IsNick(&DefaultIsNick), - IsIdent(&HandleIsIdent) + IsIdent(&DefaultIsIdent) { ServerInstance = this; -- cgit v1.2.3