]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_randquote.cpp
Remove an extern, partly because it's unused, partly because it then gets shadowed...
[user/henk/code/inspircd.git] / src / modules / m_randquote.cpp
index 08de8876d7bcda03e590b5cfc963ba3d66a0cbe2..a3b4c4a7e4d6a5e34668bbe3a7600ba2631cf849 100644 (file)
@@ -24,8 +24,8 @@ using namespace std;
 #include "modules.h"
 #include "helperfuncs.h"
 
-Server *Srv;
-FileReader *quotes = NULL;
+static Server *Srv;
+static FileReader *quotes = NULL;
 
 std::string q_file = "";
 std::string prefix = "";
@@ -62,6 +62,18 @@ class cmd_randquote : public command_t
        }
 };
 
+class RandquoteException : public ModuleException
+{
+ private:
+       std::string err;
+ public:
+       RandquoteException(std::string message) : err(message) { }
+
+       virtual const char* GetReason()
+       {
+               return (char*)err.c_str();
+       }
+};
 
 class ModuleRandQuote : public Module
 {
@@ -85,15 +97,15 @@ class ModuleRandQuote : public Module
 
                if (q_file == "")
                {
-                       log(DEFAULT,"m_randquote: Quotefile not specified - Please check your config.");
-                       return;
-                }
+                       RandquoteException e("m_randquote: Quotefile not specified - Please check your config.");
+                       throw(e);
+               }
 
                quotes = new FileReader(q_file);
                if(!quotes->Exists())
                {
-                       log(DEFAULT,"m_randquote: QuoteFile not Found!! Please check your config - module will not function.");
-                       return;
+                       RandquoteException e("m_randquote: QuoteFile not Found!! Please check your config - module will not function.");
+                       throw(e);
                }
                else
                {