* | 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>
#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 = "";
this->source = "m_randquote.so";
}
- void Handle (char** parameters, int pcntl, userrec *user)
+ void Handle (const char** parameters, int pcntl, userrec *user)
{
std::string str;
int fsize;
}
};
+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
{
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
{
Srv->AddCommand(mycommand);
}
}
+
+ void Implements(char* List)
+ {
+ List[I_OnUserConnect] = 1;
+ }
virtual ~ModuleRandQuote()
{
- delete conf;
- delete quotes;
+ DELETE(conf);
+ DELETE(quotes);
}
virtual Version GetVersion()