summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_filter_pcre.cpp19
-rw-r--r--src/modules/m_censor.cpp1
-rw-r--r--src/modules/m_filter.cpp1
-rw-r--r--src/modules/m_helpop.cpp17
4 files changed, 28 insertions, 10 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index f6ec64d6c..fe3d721d4 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -28,6 +28,15 @@ using namespace std;
#include "modules.h"
#include "helperfuncs.h"
+class FilterPCREException
+{
+ public:
+ virtual 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);
@@ -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);
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index ed576302b..0d18ac1e4 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -27,6 +27,7 @@ using namespace std;
class CensorException : public ModuleException
{
+ public:
virtual char* GetReason()
{
return "Could not find <censor file=\"\"> definition in your config file!";
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 59fbed596..c8d5633ff 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -31,6 +31,7 @@ using namespace std;
class FilterException : public ModuleException
{
+ public:
virtual char* GetReason()
{
return "Could not find <filter file=\"\"> definition in your config file!";
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 9af6d6dc4..3272b3580 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -160,6 +160,15 @@ void sendtohelpop(userrec *src, int pcnt, char **params)
Srv->SendToModeMask("oh",WM_AND,line);
}
+class HelpopException
+{
+ private:
+ std::string err;
+ public:
+ HelpopException(std::string message) : err(message) { }
+ virtual char* GetReason() { return (char*)err.c_str(); }
+};
+
class ModuleHelpop : public Module
{
private:
@@ -192,8 +201,8 @@ class ModuleHelpop : public Module
if (h_file == "")
{
helpop = NULL;
- log(DEFAULT,"m_helpop: Helpop file not Specified.");
- return;
+ HelpopException e("Missing helpop file");
+ throw(e);
}
helpop = new ConfigReader(h_file);
@@ -201,8 +210,8 @@ class ModuleHelpop : public Module
(helpop->ReadValue("nohelpo", "line1", 0) == "") ||
(helpop->ReadValue("start", "line1", 0) == ""))
{
- log(DEFAULT,"m_helpop: Helpop file is missing important entries. Please check the example conf.");
- return;
+ HelpopException e("m_helpop: Helpop file is missing important entries. Please check the example conf.");
+ throw(e);
}
}