diff options
author | Peter Powell <petpow@saberuk.com> | 2017-11-25 12:15:35 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-11-25 13:38:02 +0000 |
commit | 7ece928bab20881d6fe24c4479f4ff9e0a8a7179 (patch) | |
tree | 9006cd8dc53b482da1edc62546bedcef5542dad0 /include | |
parent | 4ac124cf89b175a0c78025e97205f4ad14fcc39d (diff) |
Convert IsNick to std::function.
Diffstat (limited to 'include')
-rw-r--r-- | include/compat.h | 2 | ||||
-rw-r--r-- | include/inspircd.h | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/include/compat.h b/include/compat.h index 1e6fc3d45..4678de12a 100644 --- a/include/compat.h +++ b/include/compat.h @@ -28,11 +28,13 @@ #if defined _LIBCPP_VERSION || defined _WIN32 # define TR1NS std # include <array> +# include <functional> # include <unordered_map> # include <type_traits> #else # define TR1NS std::tr1 # include <tr1/array> +# include <tr1/functional> # include <tr1/unordered_map> # include <tr1/type_traits> #endif diff --git a/include/inspircd.h b/include/inspircd.h index 47ec9e0e2..da86698a6 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -165,7 +165,6 @@ class serverstats } }; -DEFINE_HANDLER1(IsNickHandler, bool, const std::string&); DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t); DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&); DEFINE_HANDLER1(IsChannelHandler, bool, const std::string&); @@ -213,8 +212,6 @@ class CoreExport InspIRCd ActionList AtomicActions; /**** Functors ****/ - - IsNickHandler HandleIsNick; IsIdentHandler HandleIsIdent; IsChannelHandler HandleIsChannel; GenRandomHandler HandleGenRandom; @@ -417,11 +414,15 @@ class CoreExport InspIRCd static const char* Format(const char* formatString, ...) CUSTOM_PRINTF(1, 2); static const char* Format(va_list &vaList, const char* formatString) CUSTOM_PRINTF(2, 0); - /** Return true if a nickname is valid - * @param n A nickname to verify - * @return True if the nick is valid + /** Determines whether a nickname is valid. */ + TR1NS::function<bool(const std::string&)> IsNick; + + /** Determines whether a nickname is valid according to the RFC 1459 rules. + * This is the default function for InspIRCd::IsNick. + * @param nick The nickname to validate. + * @return True if the nickname is valid according to RFC 1459 rules; otherwise, false. */ - caller1<bool, const std::string&> IsNick; + static bool DefaultIsNick(const std::string& nick); /** Return true if an ident is valid * @param An ident to verify |