]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_filter.cpp
Improved strhashcomp with no allocations
[user/henk/code/inspircd.git] / src / modules / m_filter.cpp
index f1254e3fb748211bc2c3e8a7a2723cb4e1350d7c..1731da79881a186ce012a0118f545a7447acb28e 100644 (file)
@@ -31,6 +31,7 @@ using namespace std;
 
 class Filter
 {
+ public:
        std::string reason;
        std::string action;
 };
@@ -49,8 +50,7 @@ class FilterException : public ModuleException
 class ModuleFilter : public Module
 {
  Server *Srv;
- ConfigReader *Conf, *MyConf;
- filter_t* filters;
+ filter_t filters;
  
  public:
        ModuleFilter(Server* Me)
@@ -63,13 +63,10 @@ class ModuleFilter : public Module
                // of using a seperate config file is provided.
                Srv = Me;
                OnRehash("");
-               Srv->Log(DEFAULT,std::string("m_filter: read configuration from ")+filterfile);
        }
        
        virtual ~ModuleFilter()
        {
-               delete MyConf;
-               delete Conf;
        }
 
        void Implements(char* List)
@@ -91,7 +88,7 @@ class ModuleFilter : public Module
                {
                        if ((Srv->MatchText(text2,index->first)) || (Srv->MatchText(text,index->first)))
                        {
-                               Filter* f = (Filter*)*x->second;
+                               Filter* f = (Filter*)index->second;
                                std::string target = "";
 
                                if (target_type == TYPE_USER)
@@ -131,10 +128,10 @@ class ModuleFilter : 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.
-               Conf = new ConfigReader;
+               ConfigReader* Conf = new ConfigReader;
                std::string filterfile = Conf->ReadValue("filter","file",0);
                // this automatically re-reads the configuration file into the class
-               MyConf = new ConfigReader(filterfile);
+               ConfigReader* MyConf = new ConfigReader(filterfile);
                if ((filterfile == "") || (!MyConf->Verify()))
                {
                        // bail if the user forgot to create a config file