diff options
author | Peter Powell <petpow@saberuk.com> | 2017-11-25 12:29:05 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-11-25 13:38:02 +0000 |
commit | 3b3cb845602bbaa3935f736785a53724750230dc (patch) | |
tree | 553ec49e5f0976eee4a40141bd3da8d65da1b47a | |
parent | 7ece928bab20881d6fe24c4479f4ff9e0a8a7179 (diff) |
Convert IsIdent to std::function.
-rw-r--r-- | include/inspircd.h | 16 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 2 | ||||
-rw-r--r-- | 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<bool, const std::string&> IsIdent; + /** Determines whether an ident is valid. */ + TR1NS::function<bool(const std::string&)> 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; |