X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_regex_glob.cpp;h=44d1a5898c7987091d72fd239b26248c1e02cf12;hb=a5d110282a864fd2e91b51ce360a977cd0643657;hp=a3923205f9321771683372beb739d9282dc79759;hpb=7e843c22e16c81054bad18073d24fe1a07026431;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_regex_glob.cpp b/src/modules/m_regex_glob.cpp index a3923205f..44d1a5898 100644 --- a/src/modules/m_regex_glob.cpp +++ b/src/modules/m_regex_glob.cpp @@ -1,16 +1,23 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2008 Thomas Stagner * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + #include "m_regex.h" #include "inspircd.h" @@ -33,35 +40,28 @@ public: } }; -class ModuleRegexGlob : public Module +class GlobFactory : public RegexFactory { -public: - ModuleRegexGlob() { - ServerInstance->Modules->PublishInterface("RegularExpression", this); - } - - virtual Version GetVersion() + public: + Regex* Create(const std::string& expr) { - return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR | VF_SERVICEPROVIDER); + return new GlobRegex(expr); } - virtual ~ModuleRegexGlob() - { - ServerInstance->Modules->UnpublishInterface("RegularExpression", this); + GlobFactory(Module* m) : RegexFactory(m, "regex/glob") {} +}; + +class ModuleRegexGlob : public Module +{ + GlobFactory gf; +public: + ModuleRegexGlob() : gf(this) { + ServerInstance->Modules->AddService(gf); } - void OnRequest(Request& request) + Version GetVersion() { - if (strcmp("REGEX-NAME", request.id) == 0) - { - static_cast(request).result = "glob"; - } - else if (strcmp("REGEX", request.id) == 0) - { - RegexFactoryRequest& rfr = (RegexFactoryRequest&)request; - std::string rx = rfr.GetRegex(); - rfr.result = new GlobRegex(rx); - } + return Version("Regex module using plain wildcard matching.", VF_VENDOR); } };