From f827df84032bafa4384acb21957456e3809bc3be Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 25 Jul 2007 16:58:56 +0000 Subject: Add stuff for functors. Currently, as a test case only InspIRCd::IsNick has been 'functorized' git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7564 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'include') 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 inline void DELETE(T* x) @@ -234,6 +237,18 @@ typedef std::vector > FailedPortList; /** A list of ip addresses cross referenced against clone counts */ typedef std::map clonemap; +class InspIRCd; + +class CoreExport IsNickHandler : public HandlerBase1 +{ + 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 IsNick; /** Return true if an ident is valid * @param An ident to verify -- cgit v1.2.3