]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_regex_glob.cpp
3rd time lucky? Fix again for setsockopt.
[user/henk/code/inspircd.git] / src / modules / m_regex_glob.cpp
index d72d49896638a20026f358eca8ccc7b7562fece3..a3923205f9321771683372beb739d9282dc79759 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *          the file COPYING for details.
 #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)
+       GlobRegex(const std::string& rx) : Regex(rx)
        {
        }
 
@@ -37,16 +36,13 @@ public:
 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);
+       ModuleRegexGlob()       {
+               ServerInstance->Modules->PublishInterface("RegularExpression", this);
        }
 
        virtual Version GetVersion()
        {
-               return Version("$Id$", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER, API_VERSION);
+               return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR | VF_SERVICEPROVIDER);
        }
 
        virtual ~ModuleRegexGlob()
@@ -54,20 +50,18 @@ public:
                ServerInstance->Modules->UnpublishInterface("RegularExpression", this);
        }
 
-       virtual const char* OnRequest(Request* request)
+       void OnRequest(Request& request)
        {
-               if (strcmp("REGEX-NAME", request->GetId()) == 0)
+               if (strcmp("REGEX-NAME", request.id) == 0)
                {
-                       return "glob";
+                       static_cast<RegexNameRequest&>(request).result = "glob";
                }
-               else if (strcmp("REGEX", request->GetId()) == 0)
+               else if (strcmp("REGEX", request.id) == 0)
                {
-                       RegexFactoryRequest* rfr = (RegexFactoryRequest*)request;
-                       std::string rx = rfr->GetRegex();
-                       rfr->result = (Regex*)new GlobRegex(rx, ServerInstance);
-                       return "OK";
+                       RegexFactoryRequest& rfr = (RegexFactoryRequest&)request;
+                       std::string rx = rfr.GetRegex();
+                       rfr.result = new GlobRegex(rx);
                }
-               return NULL;
        }
 };