]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_filter.cpp
Review and optimize
[user/henk/code/inspircd.git] / src / modules / m_filter.cpp
index 59a82d61012a78f78398e5f4b4a88a97bb3daa59..d43ad7373b05bfe3edd4057ce9fb915866eb8109 100644 (file)
@@ -14,6 +14,8 @@
  * ---------------------------------------------------
  */
 
+using namespace std;
+
 // Message and notice filtering using glob patterns
 // a module based on the original work done by Craig Edwards in 2003
 // for the chatspike network.
@@ -33,20 +35,21 @@ class ModuleFilter : public Module
  ConfigReader *Conf, *MyConf;
  
  public:
-       ModuleFilter()
+       ModuleFilter(Server* Me)
+               : Module::Module(Me)
        {
                // read the configuration file on startup.
                // it is perfectly valid to set <filter file> to the value of the
                // main config file, then append your <keyword> tags to the bottom
                // of the main config... but rather messy. That's why the capability
                // of using a seperate config file is provided.
-               Srv = new Server;
+               Srv = Me;
                Conf = new ConfigReader;
                std::string filterfile = Conf->ReadValue("filter","file",0);
                MyConf = new ConfigReader(filterfile);
                if ((filterfile == "") || (!MyConf->Verify()))
                {
-                       printf("Error, could not find <filter file=\"\"> definition in your config file!");
+                       printf("Error, could not find <filter file=\"\"> definition in your config file!\n");
                        log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!");
                        return;
                }
@@ -55,7 +58,6 @@ class ModuleFilter : public Module
        
        virtual ~ModuleFilter()
        {
-               delete Srv;
                delete MyConf;
                delete Conf;
        }
@@ -158,7 +160,7 @@ class ModuleFilter : public Module
                return 0;
        }
        
-       virtual void OnRehash()
+       virtual void OnRehash(std::string parameter)
        {
                // reload our config file on rehash - we must destroy and re-allocate the classes
                // to call the constructor again and re-read our data.
@@ -199,9 +201,9 @@ class ModuleFilterFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule()
+       virtual Module * CreateModule(Server* Me)
        {
-               return new ModuleFilter;
+               return new ModuleFilter(Me);
        }
        
 };