1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
17 /* $ModDesc: Regex module using plain wildcard matching. */
19 class GlobRegex : public Regex
22 GlobRegex(const std::string& rx) : Regex(rx)
30 virtual bool Matches(const std::string& text)
32 return InspIRCd::Match(text, this->regex_string);
36 class ModuleRegexGlob : public Module
40 ServerInstance->Modules->PublishInterface("RegularExpression", this);
43 virtual Version GetVersion()
45 return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR | VF_SERVICEPROVIDER);
48 virtual ~ModuleRegexGlob()
50 ServerInstance->Modules->UnpublishInterface("RegularExpression", this);
53 void OnRequest(Request& request)
55 if (strcmp("REGEX-NAME", request.id) == 0)
57 static_cast<RegexNameRequest&>(request).result = "glob";
59 else if (strcmp("REGEX", request.id) == 0)
61 RegexFactoryRequest& rfr = (RegexFactoryRequest&)request;
62 std::string rx = rfr.GetRegex();
63 rfr.result = new GlobRegex(rx);
68 MODULE_INIT(ModuleRegexGlob)