]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_filter_pcre.cpp
kill_link() and Server::QuitUser() -> userrec::QuitUser() (static member) - this...
[user/henk/code/inspircd.git] / src / modules / extra / m_filter_pcre.cpp
index ff87d7e8add1fd3b15f9902d8b9787eb2ecd5e72..a658a60b6b879a364643f644e79ede3b354f9e9a 100644 (file)
@@ -31,7 +31,7 @@ using namespace std;
 class FilterPCREException : public ModuleException
 {
  public:
-       virtual char* GetReason()
+       virtual const char* GetReason()
        {
                return "Could not find <filter file=\"\"> definition in your config file!";
        }
@@ -91,14 +91,14 @@ class ModuleFilterPCRE : public Module
        
        virtual ~ModuleFilterPCRE()
        {
-               delete MyConf;
-               delete Conf;
+               DELETE(MyConf);
+               DELETE(Conf);
        }
 
-        void Implements(char* List)
-        {
-                List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnRehash] = 1;
-        }
+       void Implements(char* List)
+       {
+               List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnRehash] = 1;
+       }
 
        // format of a config entry is <keyword pattern="^regexp$" reason="Some reason here" action="kill/block">
        
@@ -144,7 +144,7 @@ class ModuleFilterPCRE : public Module
 
                                if (do_action == "kill")
                                {
-                                       Srv->QuitUser(user,reason);
+                                       userrec::QuitUser(user,reason);
                                }
                                return 1;
                        }
@@ -156,8 +156,8 @@ class ModuleFilterPCRE : public Module
        {
                // reload our config file on rehash - we must destroy and re-allocate the classes
                // to call the constructor again and re-read our data.
-               delete Conf;
-               delete MyConf;
+               DELETE(Conf);
+               DELETE(MyConf);
                Conf = new ConfigReader;
                std::string filterfile = Conf->ReadValue("filter","file",0);
                // this automatically re-reads the configuration file into the class
@@ -170,22 +170,22 @@ class ModuleFilterPCRE : public Module
                }
                Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile);
 
-                filters.clear();
-                for (int index = 0; index < MyConf->Enumerate("keyword"); index++)
-                {
-                        std::string pattern = MyConf->ReadValue("keyword","pattern",index);
-                        re = pcre_compile(pattern.c_str(),0,&error,&erroffset,NULL);
-                        if (!re)
-                        {
-                                log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error);
-                                log(DEFAULT,"Regular expression %s not loaded.", pattern.c_str());
-                        }
-                        else
-                        {
-                                filters.push_back(re);
-                                log(DEFAULT,"Regular expression %s loaded.", pattern.c_str());
-                        }
-                }
+               filters.clear();
+               for (int index = 0; index < MyConf->Enumerate("keyword"); index++)
+               {
+                       std::string pattern = MyConf->ReadValue("keyword","pattern",index);
+                       re = pcre_compile(pattern.c_str(),0,&error,&erroffset,NULL);
+                       if (!re)
+                       {
+                               log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error);
+                               log(DEFAULT,"Regular expression %s not loaded.", pattern.c_str());
+                       }
+                       else
+                       {
+                               filters.push_back(re);
+                               log(DEFAULT,"Regular expression %s loaded.", pattern.c_str());
+                       }
+               }
 
        }