diff options
author | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-20 23:01:53 +0000 |
---|---|---|
committer | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-20 23:01:53 +0000 |
commit | b3cbd1a15354f593b1c891b870bf7f2f276f74d7 (patch) | |
tree | b21dc145751245465b604563bdf3d336bbc06de0 /src/modules/extra | |
parent | df91e30723c9cfb91ff0c7f6506fe67ef4909b89 (diff) |
Move m_regex.h and m_regex_glob.cpp to main modules directory, as these have no requirements.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10571 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_regex.h | 76 | ||||
-rw-r--r-- | src/modules/extra/m_regex_glob.cpp | 67 |
2 files changed, 0 insertions, 143 deletions
diff --git a/src/modules/extra/m_regex.h b/src/modules/extra/m_regex.h deleted file mode 100644 index 50e7a4845..000000000 --- a/src/modules/extra/m_regex.h +++ /dev/null @@ -1,76 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef _M_REGEX_H -#define _M_REGEX_H - -#include "inspircd.h" - -class Regex : public classbase -{ -protected: - std::string regex_string; // The raw uncompiled regex string. - InspIRCd* ServerInstance; - - // Constructor may as well be protected, as this class is abstract. - Regex(const std::string& rx, InspIRCd* Me) : regex_string(rx), ServerInstance(Me) - { - } - -public: - - virtual ~Regex() - { - } - - virtual bool Matches(const std::string& text) = 0; - - const std::string& GetRegexString() const - { - return regex_string; - } -}; - -class RegexFactoryRequest : public Request -{ -private: - std::string regex; - -public: - Regex* result; - - RegexFactoryRequest(Module* Me, Module* Target, const std::string& rx) : Request(Me, Target, "REGEX"), regex(rx), result(NULL) - { - } - - const std::string& GetRegex() const - { - return regex; - } - - Regex* Create() - { - Send(); - return this->result; - } -}; - -class RegexNameRequest : public Request -{ -public: - RegexNameRequest(Module* Me, Module* Target) : Request(Me, Target, "REGEX-NAME") - { - } -}; - -#endif diff --git a/src/modules/extra/m_regex_glob.cpp b/src/modules/extra/m_regex_glob.cpp deleted file mode 100644 index 7977c77f1..000000000 --- a/src/modules/extra/m_regex_glob.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "m_regex.h" -#include "inspircd.h" - -/* $ModDesc: Regex module using plain wildcard matching. */ -/* $ModDep: m_regex.h */ - -class GlobRegex : public Regex -{ -public: - GlobRegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) - { - } - - virtual ~GlobRegex() - { - } - - virtual bool Matches(const std::string& text) - { - return InspIRCd::Match(this->regex_string, text); - } -}; - -class ModuleRegexGlob : public Module -{ -public: - ModuleRegexGlob(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); - Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); - } - - virtual ~ModuleRegexGlob() - { - ServerInstance->Modules->UnpublishInterface("RegularExpression", this); - } - - virtual const char* OnRequest(Request* request) - { - if (strcmp("REGEX-NAME", request->GetId()) == 0) - { - return "glob"; - } - else if (strcmp("REGEX", request->GetId()) == 0) - { - RegexFactoryRequest* rfr = (RegexFactoryRequest*)request; - std::string rx = rfr->GetRegex(); - rfr->result = (Regex*)new GlobRegex(rx, ServerInstance); - return "OK"; - } - return NULL; - } -}; |