From 7ece928bab20881d6fe24c4479f4ff9e0a8a7179 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 25 Nov 2017 12:15:35 +0000 Subject: Convert IsNick to std::function. --- src/helperfuncs.cpp | 2 +- src/inspircd.cpp | 2 +- src/modules/m_nationalchars.cpp | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index ddcff5e55..5d4778b63 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -216,7 +216,7 @@ bool IsChannelHandler::Call(const std::string& chname) } /* true for valid nickname, false else */ -bool IsNickHandler::Call(const std::string& n) +bool InspIRCd::DefaultIsNick(const std::string& n) { if (n.empty() || n.length() > ServerInstance->Config->Limits.NickMax) return false; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 6c45a1a0d..20001dbca 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -228,7 +228,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : */ GenRandom(&HandleGenRandom), IsChannel(&HandleIsChannel), - IsNick(&HandleIsNick), + IsNick(&DefaultIsNick), IsIdent(&HandleIsIdent) { ServerInstance = this; diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index bb95ecc93..81c2d2959 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -28,10 +28,10 @@ #include "inspircd.h" #include -class lwbNickHandler : public HandlerBase1 +class lwbNickHandler { public: - bool Call(const std::string&) CXX11_OVERRIDE; + static bool Call(const std::string&); }; /*,m_reverse_additionalUp[256];*/ @@ -217,10 +217,9 @@ bool lwbNickHandler::Call(const std::string& nick) class ModuleNationalChars : public Module { - lwbNickHandler myhandler; std::string charset; unsigned char m_additional[256], m_additionalUp[256], m_lower[256], m_upper[256]; - caller1 rememberer; + TR1NS::function rememberer; bool forcequit; const unsigned char * lowermap_rememberer; unsigned char prev_map[256]; @@ -259,7 +258,7 @@ class ModuleNationalChars : public Module memcpy(m_lower, rfc_case_insensitive_map, 256); national_case_insensitive_map = m_lower; - ServerInstance->IsNick = &myhandler; + ServerInstance->IsNick = &lwbNickHandler::Call; } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE -- cgit v1.2.3