]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_filter_pcre.cpp
Giving printf formats and not giving it arguments for them != cunning
[user/henk/code/inspircd.git] / src / modules / extra / m_filter_pcre.cpp
index f6ec64d6c5ece563e2b99f8103430b409ad127ef..ade243fb4fd6cb217ea7b11a42740fe57553f4e3 100644 (file)
@@ -28,6 +28,15 @@ using namespace std;
 #include "modules.h"
 #include "helperfuncs.h"
 
+class FilterPCREException : public ModuleException
+{
+ public:
+       virtual const char* GetReason()
+       {
+               return "Could not find <filter file=\"\"> definition in your config file!";
+       }
+};
+
 /* $ModDesc: m_filter with regexps */
 /* $CompileFlags: -I/usr/local/include */
 /* $LinkerFlags: -L/usr/local/lib -lpcre */
@@ -56,9 +65,8 @@ class ModuleFilterPCRE : public Module
                MyConf = new ConfigReader(filterfile);
                if ((filterfile == "") || (!MyConf->Verify()))
                {
-                       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;
+                       FilterPCREException e;
+                       throw(e);
                }
                Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile);
 
@@ -144,7 +152,7 @@ class ModuleFilterPCRE : public Module
                return 0;
        }
        
-       virtual void OnRehash(std::string parameter)
+       virtual void OnRehash(const 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.
@@ -156,10 +164,9 @@ class ModuleFilterPCRE : public Module
                MyConf = new ConfigReader(filterfile);
                if ((filterfile == "") || (!MyConf->Verify()))
                {
+                       FilterPCREException e;
                        // bail if the user forgot to create a config file
-                       printf("Error, could not find <filter file=\"\"> definition in your config file!");
-                       log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!");
-                       return;
+                       throw(e);
                }
                Srv->Log(DEFAULT,std::string("m_filter_pcre: read configuration from ")+filterfile);