]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_helpop.cpp
Probably wont compile yet - purge_empty_channels refactor
[user/henk/code/inspircd.git] / src / modules / m_helpop.cpp
index 548bb9c1d40872fa8f6d07e167db7d6615959662..a76cb87a8a1aba9413184254dae0c46bbb19319f 100644 (file)
@@ -2,7 +2,7 @@
  *   | Inspire Internet Relay Chat Daemon |
  *   +------------------------------------+
  *
- *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
  *   E-mail:
  *<brain@chatspike.net>
  *       <Craig@chatspike.net>
@@ -22,9 +22,8 @@ using namespace std;
 #include "helperfuncs.h"
 
 // Global Vars
-/* XXX - should all this be marked static? clear the global namespace, etc. */
-ConfigReader *helpop;
-Server *Srv;
+static ConfigReader *helpop;
+static Server *Srv;
 
 void handle_helpop(char**, int, userrec*);
 bool do_helpop(char**, int, userrec*);
@@ -160,6 +159,15 @@ void sendtohelpop(userrec *src, int pcnt, char **params)
        Srv->SendToModeMask("oh",WM_AND,line);
 }
 
+class HelpopException : public ModuleException
+{
+ 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 +200,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 +209,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);
                        }
                }