diff options
-rw-r--r-- | include/inspircd.h | 30 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 2 | ||||
-rw-r--r-- | src/inspircd.cpp | 5 |
3 files changed, 30 insertions, 7 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index cf7201c59..ba6c2b174 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -38,6 +38,7 @@ #include "snomasks.h" #include "cull_list.h" #include "filelogger.h" +#include "caller.h" /** * Used to define the maximum number of parameters a command may have. @@ -61,6 +62,8 @@ */ #define IS_SINGLE(x,y) ( (*x == y) && (*(x+1) == 0) ) + + /** Delete a pointer, and NULL its value */ template<typename T> inline void DELETE(T* x) @@ -234,6 +237,18 @@ typedef std::vector<std::pair<std::string, long> > FailedPortList; /** A list of ip addresses cross referenced against clone counts */ typedef std::map<irc::string, unsigned int> clonemap; +class InspIRCd; + +class CoreExport IsNickHandler : public HandlerBase1<bool, const char*> +{ + InspIRCd* Server; + public: + IsNickHandler(InspIRCd* Srv) : Server(Srv) { } + virtual ~IsNickHandler() { } + virtual bool Call(const char*); +}; + + /* Forward declaration - required */ class XLineManager; @@ -367,6 +382,15 @@ class CoreExport InspIRCd : public classbase public: + /** Global cull list, will be processed on next iteration + */ + CullList GlobalCulls; + + + /**** Functors ****/ + + IsNickHandler HandleIsNick; + /** InspSocket classes pending deletion after being closed. * We don't delete these immediately as this may cause a segmentation fault. */ @@ -470,10 +494,6 @@ class CoreExport InspIRCd : public classbase */ time_t next_call; - /** Global cull list, will be processed on next iteration - */ - CullList GlobalCulls; - /** Get the current time * Because this only calls time() once every time around the mainloop, * it is much faster than calling time() directly. @@ -842,7 +862,7 @@ class CoreExport InspIRCd : public classbase * @param n A nickname to verify * @return True if the nick is valid */ - bool IsNick(const char* n); + caller1<bool, const char*> IsNick; /** Return true if an ident is valid * @param An ident to verify diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 0bcee0711..8e6627d1f 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -389,7 +389,7 @@ bool InspIRCd::IsChannel(const char *chname) } /* true for valid nickname, false else */ -bool InspIRCd::IsNick(const char* n) +bool IsNickHandler::Call(const char* n) { if (!n || !*n) return false; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 4a53c2a05..09f1e8685 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -39,6 +39,7 @@ #include "typedefs.h" #include "command_parse.h" #include "exitcodes.h" +#include "caller.h" #ifdef WIN32 @@ -391,7 +392,9 @@ void InspIRCd::WritePID(const std::string &filename) } InspIRCd::InspIRCd(int argc, char** argv) - : ModCount(-1), GlobalCulls(this) + : ModCount(0), + GlobalCulls(this), + HandleIsNick(this), IsNick(&HandleIsNick) { int found_ports = 0; FailedPortList pl; |