summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 01:35:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 01:35:01 +0000
commit12737ab4ad61a0d8a908c8a21594c7012e21eb3c (patch)
treebf819b3a528227d3ddf929e25e8b74d1db8ef1c7
parentb8383dcc9524ca832de7daf56f44fe54b19e5bdc (diff)
ConfigReader and FileReader now take InspIRCd* to their constructors
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4865 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/commands/cmd_stats.h2
-rw-r--r--include/commands/cmd_whois.h2
-rw-r--r--include/modules.h15
-rw-r--r--include/u_listmode.h2
-rw-r--r--src/cmd_admin.cpp2
-rw-r--r--src/cmd_away.cpp2
-rw-r--r--src/cmd_commands.cpp2
-rw-r--r--src/cmd_die.cpp2
-rw-r--r--src/cmd_eline.cpp2
-rw-r--r--src/cmd_gline.cpp2
-rw-r--r--src/cmd_info.cpp2
-rw-r--r--src/cmd_invite.cpp2
-rw-r--r--src/cmd_ison.cpp2
-rw-r--r--src/cmd_join.cpp2
-rw-r--r--src/cmd_kick.cpp2
-rw-r--r--src/cmd_kill.cpp2
-rw-r--r--src/cmd_kline.cpp2
-rw-r--r--src/cmd_links.cpp2
-rw-r--r--src/cmd_list.cpp2
-rw-r--r--src/cmd_loadmodule.cpp2
-rw-r--r--src/cmd_lusers.cpp2
-rw-r--r--src/cmd_map.cpp2
-rw-r--r--src/cmd_modules.cpp2
-rw-r--r--src/cmd_names.cpp2
-rw-r--r--src/cmd_nick.cpp2
-rw-r--r--src/cmd_notice.cpp2
-rw-r--r--src/cmd_oper.cpp2
-rw-r--r--src/cmd_part.cpp2
-rw-r--r--src/cmd_ping.cpp2
-rw-r--r--src/cmd_privmsg.cpp2
-rw-r--r--src/cmd_qline.cpp2
-rw-r--r--src/cmd_quit.cpp2
-rw-r--r--src/cmd_rehash.cpp2
-rw-r--r--src/cmd_restart.cpp2
-rw-r--r--src/cmd_server.cpp2
-rw-r--r--src/cmd_stats.cpp6
-rw-r--r--src/cmd_time.cpp2
-rw-r--r--src/cmd_topic.cpp2
-rw-r--r--src/cmd_trace.cpp2
-rw-r--r--src/cmd_unloadmodule.cpp2
-rw-r--r--src/cmd_user.cpp2
-rw-r--r--src/cmd_userhost.cpp2
-rw-r--r--src/cmd_version.cpp4
-rw-r--r--src/cmd_wallops.cpp2
-rw-r--r--src/cmd_who.cpp2
-rw-r--r--src/cmd_whois.cpp6
-rw-r--r--src/cmd_whowas.cpp2
-rw-r--r--src/cmd_zline.cpp2
-rw-r--r--src/inspsocket.cpp2
-rw-r--r--src/modules.cpp15
-rw-r--r--src/modules/m_alias.cpp4
-rw-r--r--src/modules/m_blockamsg.cpp2
-rw-r--r--src/modules/m_censor.cpp4
-rw-r--r--src/modules/m_cgiirc.cpp2
-rw-r--r--src/modules/m_chanprotect.cpp2
-rw-r--r--src/modules/m_cloaking.cpp2
-rw-r--r--src/modules/m_conn_waitpong.cpp2
-rw-r--r--src/modules/m_connflood.cpp2
-rw-r--r--src/modules/m_denychans.cpp4
-rw-r--r--src/modules/m_filter.cpp4
-rw-r--r--src/modules/m_helpop.cpp4
-rw-r--r--src/modules/m_hostchange.cpp4
-rw-r--r--src/modules/m_httpd.cpp17
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_ident.cpp2
-rw-r--r--src/modules/m_messageflood.cpp2
-rw-r--r--src/modules/m_operjoin.cpp4
-rw-r--r--src/modules/m_operlevels.cpp4
-rw-r--r--src/modules/m_opermodes.cpp4
-rw-r--r--src/modules/m_opermotd.cpp112
-rw-r--r--src/modules/m_override.cpp2
-rw-r--r--src/modules/m_park.cpp2
-rw-r--r--src/modules/m_randquote.cpp4
-rw-r--r--src/modules/m_remove.cpp3
-rw-r--r--src/modules/m_restrictchans.cpp2
-rw-r--r--src/modules/m_spanningtree.cpp10
-rw-r--r--src/modules/m_swhois.cpp4
-rw-r--r--src/modules/m_timedbans.cpp2
-rw-r--r--src/modules/m_vhost.cpp4
79 files changed, 176 insertions, 176 deletions
diff --git a/include/commands/cmd_stats.h b/include/commands/cmd_stats.h
index 7e4cf905a..74cf86d4c 100644
--- a/include/commands/cmd_stats.h
+++ b/include/commands/cmd_stats.h
@@ -28,7 +28,7 @@
#include "users.h"
#include "channels.h"
-void DoStats(char statschar, userrec* user, string_list &results);
+void DoStats(InspIRCd* Instance, char statschar, userrec* user, string_list &results);
class cmd_stats : public command_t
{
diff --git a/include/commands/cmd_whois.h b/include/commands/cmd_whois.h
index 5f44e3530..962444a82 100644
--- a/include/commands/cmd_whois.h
+++ b/include/commands/cmd_whois.h
@@ -28,7 +28,7 @@
#include "users.h"
#include "channels.h"
-void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick);
+void do_whois(InspIRCd* Instance, userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick);
class cmd_whois : public command_t
{
diff --git a/include/modules.h b/include/modules.h
index 90c06361f..9ca7eab5e 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -188,9 +188,6 @@ class Version : public classbase
class ModuleMessage : public classbase
{
public:
- /** This class is pure virtual and must be inherited.
- */
- virtual char* Send() = 0;
virtual ~ModuleMessage() {};
};
@@ -294,7 +291,7 @@ class Event : public ModuleMessage
* The return result of an Event::Send() will always be NULL as
* no replies are expected.
*/
- char* Send();
+ char* Send(InspIRCd* ServerInstance);
};
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
@@ -1258,6 +1255,7 @@ class Module : public Extensible
class ConfigReader : public classbase
{
protected:
+ InspIRCd* ServerInstance;
/** The contents of the configuration file
* This protected member should never be accessed by a module (and cannot be accessed unless the
* core is changed). It will contain a pointer to the configuration file data with unneeded data
@@ -1276,11 +1274,11 @@ class ConfigReader : public classbase
* This constructor initialises the ConfigReader class to read the inspircd.conf file
* as specified when running ./configure.
*/
- ConfigReader(); // default constructor reads ircd.conf
+ ConfigReader(InspIRCd* Instance);
/** Overloaded constructor.
* This constructor initialises the ConfigReader class to read a user-specified config file
*/
- ConfigReader(const std::string &filename); // read a module-specific config
+ ConfigReader(InspIRCd* Instance, const std::string &filename);
/** Default destructor.
* This method destroys the ConfigReader class.
*/
@@ -1347,6 +1345,7 @@ class ConfigReader : public classbase
*/
class FileReader : public classbase
{
+ InspIRCd* ServerInstance;
/** The file contents
*/
file_cache fc;
@@ -1360,14 +1359,14 @@ class FileReader : public classbase
* This method does not load any file into memory, you must use the LoadFile method
* after constructing the class this way.
*/
- FileReader();
+ FileReader(InspIRCd* Instance);
/** Secondary constructor.
* This method initialises the class with a file loaded into it ready for GetLine and
* and other methods to be called. If the file could not be loaded, FileReader::FileSize
* returns 0.
*/
- FileReader(const std::string &filename);
+ FileReader(InspIRCd* Instance, const std::string &filename);
/** Default destructor.
* This deletes the memory allocated to the file.
diff --git a/include/u_listmode.h b/include/u_listmode.h
index bd5bde74c..ed27d15ea 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -101,7 +101,7 @@ class ListModeBase : public ModeHandler
virtual void DoRehash()
{
- ConfigReader Conf;
+ ConfigReader Conf(ServerInstance);
chanlimits.clear();
diff --git a/src/cmd_admin.cpp b/src/cmd_admin.cpp
index fb370f4e6..98dd13f7e 100644
--- a/src/cmd_admin.cpp
+++ b/src/cmd_admin.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_admin.h"
-extern InspIRCd* ServerInstance;
+
void cmd_admin::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_away.cpp b/src/cmd_away.cpp
index caef2c829..60833562d 100644
--- a/src/cmd_away.cpp
+++ b/src/cmd_away.cpp
@@ -23,7 +23,7 @@
#include "helperfuncs.h"
#include "commands/cmd_away.h"
-extern InspIRCd* ServerInstance;
+
void cmd_away::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_commands.cpp b/src/cmd_commands.cpp
index dfcc874c9..107ae1e31 100644
--- a/src/cmd_commands.cpp
+++ b/src/cmd_commands.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_commands.h"
-extern InspIRCd* ServerInstance;
+
void cmd_commands::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp
index e561acefc..750af1976 100644
--- a/src/cmd_die.cpp
+++ b/src/cmd_die.cpp
@@ -23,7 +23,7 @@
#include "helperfuncs.h"
#include "commands/cmd_die.h"
-extern InspIRCd* ServerInstance;
+
void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index c7e50eb16..011cb6851 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_eline.h"
-extern InspIRCd* ServerInstance;
+
void cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 208afd09c..7eeec2820 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_eline.h"
-extern InspIRCd* ServerInstance;
+
void cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp
index e792f5fc2..6c89ff59e 100644
--- a/src/cmd_info.cpp
+++ b/src/cmd_info.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_info.h"
-extern InspIRCd* ServerInstance;
+
void cmd_info::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index f418fda5d..423624a01 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -22,7 +22,7 @@
#include "helperfuncs.h"
#include "commands/cmd_invite.h"
-extern InspIRCd* ServerInstance;
+
void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp
index 1fefeab1c..fd6e92df2 100644
--- a/src/cmd_ison.cpp
+++ b/src/cmd_ison.cpp
@@ -22,7 +22,7 @@
#include "inspircd.h"
#include "commands/cmd_ison.h"
-extern InspIRCd* ServerInstance;
+
void cmd_ison::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_join.cpp b/src/cmd_join.cpp
index d62b0a911..5f214b3aa 100644
--- a/src/cmd_join.cpp
+++ b/src/cmd_join.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_join.h"
-extern InspIRCd* ServerInstance;
+
void cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index 5c03921b6..9c517ee9e 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -21,7 +21,7 @@
#include "inspircd.h"
#include "commands/cmd_kick.h"
-extern InspIRCd* ServerInstance;
+
void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index ca2e9c6b4..2143451b3 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_kill.h"
-extern InspIRCd* ServerInstance;
+
void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index dc6c49dc2..83501bed2 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -31,7 +31,7 @@
#include "helperfuncs.h"
#include "commands/cmd_kline.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_links.cpp b/src/cmd_links.cpp
index d8de3c8d6..3b2fc9a21 100644
--- a/src/cmd_links.cpp
+++ b/src/cmd_links.cpp
@@ -22,7 +22,7 @@
#include "helperfuncs.h"
#include "commands/cmd_links.h"
-extern InspIRCd* ServerInstance;
+
void cmd_links::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp
index ded20d077..9b6fbfd05 100644
--- a/src/cmd_list.cpp
+++ b/src/cmd_list.cpp
@@ -21,7 +21,7 @@
#include "inspircd.h"
#include "commands/cmd_list.h"
-extern InspIRCd* ServerInstance;
+
void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_loadmodule.cpp b/src/cmd_loadmodule.cpp
index bef24f321..835a5b170 100644
--- a/src/cmd_loadmodule.cpp
+++ b/src/cmd_loadmodule.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_loadmodule.h"
-extern InspIRCd* ServerInstance;
+
void cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_lusers.cpp b/src/cmd_lusers.cpp
index acb43c7ce..8ab9392bc 100644
--- a/src/cmd_lusers.cpp
+++ b/src/cmd_lusers.cpp
@@ -20,7 +20,7 @@
#include "inspircd.h"
#include "commands/cmd_lusers.h"
-extern InspIRCd* ServerInstance;
+
void cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp
index e0f77e3b8..8463addc5 100644
--- a/src/cmd_map.cpp
+++ b/src/cmd_map.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_map.h"
-extern InspIRCd* ServerInstance;
+
void cmd_map::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index c665580f7..73a226bf1 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -31,7 +31,7 @@
#include "wildcard.h"
#include "commands/cmd_modules.h"
-extern InspIRCd* ServerInstance;
+
char* itab[] = {
"OnUserConnect", "OnUserQuit", "OnUserDisconnect", "OnUserJoin", "OnUserPart", "OnRehash", "OnServerRaw",
diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp
index 0ce00e4ba..70b1876a1 100644
--- a/src/cmd_names.cpp
+++ b/src/cmd_names.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_names.h"
-extern InspIRCd* ServerInstance;
+
void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index 5dacc4812..c4db7ba24 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -28,7 +28,7 @@
#include "hashcomp.h"
#include "commands/cmd_nick.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index f94ac5bb7..0a80bf57f 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -28,7 +28,7 @@
#include "hashcomp.h"
#include "commands/cmd_notice.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index a15c3d7e0..df615b503 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -36,7 +36,7 @@
#include "command_parse.h"
#include "commands/cmd_oper.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp
index 88aab1abf..10c95661b 100644
--- a/src/cmd_part.cpp
+++ b/src/cmd_part.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_part.h"
-extern InspIRCd* ServerInstance;
+
void cmd_part::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp
index a0caeb3cd..5ece8b941 100644
--- a/src/cmd_ping.cpp
+++ b/src/cmd_ping.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_ping.h"
-extern InspIRCd* ServerInstance;
+
void cmd_ping::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 06207059d..59a450fef 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -25,7 +25,7 @@
#include "helperfuncs.h"
#include "commands/cmd_privmsg.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index 3e5e9fbdf..90e3c99fc 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -23,7 +23,7 @@
#include "helperfuncs.h"
#include "commands/cmd_qline.h"
-extern InspIRCd* ServerInstance;
+
void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp
index 9c1e11179..25397edcb 100644
--- a/src/cmd_quit.cpp
+++ b/src/cmd_quit.cpp
@@ -34,7 +34,7 @@
#include "socketengine.h"
#include "commands/cmd_quit.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp
index bb09734a6..0a535adc3 100644
--- a/src/cmd_rehash.cpp
+++ b/src/cmd_rehash.cpp
@@ -21,7 +21,7 @@
#include "commands.h"
#include "commands/cmd_rehash.h"
-extern InspIRCd* ServerInstance;
+
void cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_restart.cpp b/src/cmd_restart.cpp
index 318a8ee31..c72a16495 100644
--- a/src/cmd_restart.cpp
+++ b/src/cmd_restart.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_restart.h"
-extern InspIRCd* ServerInstance;
+
void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_server.cpp b/src/cmd_server.cpp
index 93274e040..b932a2089 100644
--- a/src/cmd_server.cpp
+++ b/src/cmd_server.cpp
@@ -20,7 +20,7 @@
#include "inspircd.h"
#include "commands/cmd_server.h"
-extern InspIRCd* ServerInstance;
+
void cmd_server::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index e8d92e106..3ed8c8b9f 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -41,19 +41,19 @@
#include "command_parse.h"
#include "commands/cmd_stats.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
{
string_list values;
- DoStats(*parameters[0], user, values);
+ DoStats(this->ServerInstance, *parameters[0], user, values);
for (size_t i = 0; i < values.size(); i++)
user->Write(":%s", values[i].c_str());
}
-void DoStats(char statschar, userrec* user, string_list &results)
+void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_list &results)
{
std::string sn = ServerInstance->Config->ServerName;
diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp
index f87f398c8..c9d47b813 100644
--- a/src/cmd_time.cpp
+++ b/src/cmd_time.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_time.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index e745e5abc..dccdfcb3f 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -22,7 +22,7 @@
#include "commands/cmd_topic.h"
#include "helperfuncs.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp
index 48f00c62d..675681e3a 100644
--- a/src/cmd_trace.cpp
+++ b/src/cmd_trace.cpp
@@ -20,7 +20,7 @@
#include "inspircd.h"
#include "commands/cmd_trace.h"
-extern InspIRCd* ServerInstance;
+
void cmd_trace::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp
index 70cf2c698..2b0d8dbf3 100644
--- a/src/cmd_unloadmodule.cpp
+++ b/src/cmd_unloadmodule.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_unloadmodule.h"
-extern InspIRCd* ServerInstance;
+
void cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 79bb9c691..22cfbfab1 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_user.h"
-extern InspIRCd* ServerInstance;
+
void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp
index 64210b57a..cf7000b5d 100644
--- a/src/cmd_userhost.cpp
+++ b/src/cmd_userhost.cpp
@@ -21,7 +21,7 @@
#include "inspircd.h"
#include "commands/cmd_userhost.h"
-extern InspIRCd* ServerInstance;
+
void cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_version.cpp b/src/cmd_version.cpp
index 3d98491f1..884e533e6 100644
--- a/src/cmd_version.cpp
+++ b/src/cmd_version.cpp
@@ -21,8 +21,8 @@
#include "helperfuncs.h"
#include "commands/cmd_version.h"
-extern InspIRCd* ServerInstance;
-extern InspIRCd* ServerInstance;
+
+
void cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp
index 91c6853e3..9e278ca6c 100644
--- a/src/cmd_wallops.cpp
+++ b/src/cmd_wallops.cpp
@@ -20,7 +20,7 @@
#include "helperfuncs.h"
#include "commands/cmd_wallops.h"
-extern InspIRCd* ServerInstance;
+
void cmd_wallops::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp
index e5b6c60cd..16e746ee3 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -22,7 +22,7 @@
#include "wildcard.h"
#include "commands/cmd_who.h"
-extern InspIRCd* ServerInstance;
+
/* get the last 'visible' chan of a user */
static char *getlastchanname(userrec *u)
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp
index 15ae9110b..2ee5e8b49 100644
--- a/src/cmd_whois.cpp
+++ b/src/cmd_whois.cpp
@@ -22,7 +22,7 @@
#include "helperfuncs.h"
#include "commands/cmd_whois.h"
-extern InspIRCd* ServerInstance;
+
extern time_t TIME;
@@ -36,7 +36,7 @@ const char* Spacify(char* n)
return x;
}
-void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick)
+void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick)
{
// bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER
if (dest->registered == REG_ALL)
@@ -106,7 +106,7 @@ void cmd_whois::Handle (const char** parameters, int pcnt, userrec *user)
dest = ServerInstance->FindNick(parameters[0]);
if (dest)
{
- do_whois(user,dest,0,0,parameters[0]);
+ do_whois(this->ServerInstance, user,dest,0,0,parameters[0]);
}
else
{
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index b4292857c..b300782c5 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_whowas.h"
-extern InspIRCd* ServerInstance;
+
extern irc::whowas::whowas_users whowas;
void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index f62c7058a..00396a1ae 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_zline.h"
-extern InspIRCd* ServerInstance;
+
void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
{
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 804b00c74..aa3b68ed5 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -170,7 +170,7 @@ void InspSocket::SetQueues(int nfd)
bool InspSocket::BindAddr()
{
insp_inaddr n;
- ConfigReader Conf;
+ ConfigReader Conf(this->Instance);
log(DEBUG,"In InspSocket::BindAddr()");
for (int j =0; j < Conf.Enumerate("bind"); j++)
diff --git a/src/modules.cpp b/src/modules.cpp
index 03e7856f7..fc772c797 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -45,7 +45,6 @@
#include "dns.h"
#include "inspircd.h"
-extern InspIRCd* ServerInstance;
extern time_t TIME;
extern command_table cmdlist;
@@ -116,7 +115,7 @@ Module* Event::GetSource()
return this->source;
}
-char* Event::Send()
+char* Event::Send(InspIRCd* ServerInstance)
{
FOREACH_MOD(I_OnEvent,OnEvent(this));
return NULL;
@@ -438,7 +437,7 @@ bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &
{
log(DEBUG,"PseudoToUser");
zombie->fd = alive->fd;
- FOREACH_MOD(I_OnUserQuit,OnUserQuit(alive,message));
+ FOREACH_MOD_I(this,I_OnUserQuit,OnUserQuit(alive,message));
alive->fd = FD_MAGIC_NUMBER;
alive->FlushWriteBuf();
alive->ClearBuffer();
@@ -580,7 +579,7 @@ Module* InspIRCd::FindModule(const std::string &name)
return NULL;
}
-ConfigReader::ConfigReader()
+ConfigReader::ConfigReader(InspIRCd* Instance) : ServerInstance(Instance)
{
/* Is there any reason to load the entire config file again here?
* it's needed if they specify another config file, but using the
@@ -602,10 +601,10 @@ ConfigReader::~ConfigReader()
}
-ConfigReader::ConfigReader(const std::string &filename)
+ConfigReader::ConfigReader(InspIRCd* Instance, const std::string &filename) : ServerInstance(Instance)
{
ServerInstance->Config->ClearStack();
-
+
this->data = new ConfigDataHash;
this->privatehash = true;
this->errorlog = new std::ostringstream(std::stringstream::in | std::stringstream::out);
@@ -720,7 +719,7 @@ bool ConfigReader::Verify()
}
-FileReader::FileReader(const std::string &filename)
+FileReader::FileReader(InspIRCd* Instance, const std::string &filename) : ServerInstance(Instance)
{
file_cache c;
ServerInstance->Config->ReadFile(c,filename.c_str());
@@ -728,7 +727,7 @@ FileReader::FileReader(const std::string &filename)
this->CalcSize();
}
-FileReader::FileReader()
+FileReader::FileReader(InspIRCd* Instance) : ServerInstance(Instance)
{
}
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 3e09aef2f..f3e2ed3f8 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -71,7 +71,7 @@ class ModuleAlias : public Module
: Module::Module(Me)
{
- MyConf = new ConfigReader;
+ MyConf = new ConfigReader(ServerInstance);
ReadAliases();
}
@@ -149,7 +149,7 @@ class ModuleAlias : public Module
virtual void OnRehash(const std::string &parameter)
{
DELETE(MyConf);
- MyConf = new ConfigReader;
+ MyConf = new ConfigReader(ServerInstance);
ReadAliases();
}
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index 856b4bd88..38fed16d6 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -74,7 +74,7 @@ public:
virtual void OnRehash(const std::string &parameter)
{
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader* Conf = new ConfigReader(ServerInstance);
ForgetDelay = Conf->ReadInteger("blockamsg", "delay", 0, false);
if(Conf->GetError() == CONF_VALUE_NOT_FOUND)
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 796224890..d227a2347 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -203,10 +203,10 @@ class ModuleCensor : public Module
* reload our config file on rehash - we must destroy and re-allocate the classes
* to call the constructor again and re-read our data.
*/
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader* Conf = new ConfigReader(ServerInstance);
std::string Censorfile = Conf->ReadValue("censor","file",0);
// this automatically re-reads the configuration file into the class
- ConfigReader* MyConf = new ConfigReader(Censorfile);
+ ConfigReader* MyConf = new ConfigReader(ServerInstance, Censorfile);
if ((Censorfile == "") || (!MyConf->Verify()))
{
CensorException e;
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 05f34d037..d89c2c3e3 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -110,7 +110,7 @@ public:
virtual void OnRehash(const std::string &parameter)
{
- ConfigReader Conf;
+ ConfigReader Conf(ServerInstance);
NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed.
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index c9cdc2f60..c88b99cdc 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -297,7 +297,7 @@ class ModuleChanProtect : public Module
* object was kept between rehashes...now we just
* stack-allocate it locally.
*/
- ConfigReader Conf;
+ ConfigReader Conf(ServerInstance);
FirstInGetsFounder = Conf.ReadFlag("options","noservices",0);
}
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index e00e0ac86..fcda8881a 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -374,7 +374,7 @@ class CloakUser : public ModeHandler
void DoRehash()
{
- ConfigReader Conf;
+ ConfigReader Conf(ServerInstance);
key1 = key2 = key3 = key4 = 0;
key1 = Conf.ReadInteger("cloak","key1",0,false);
key2 = Conf.ReadInteger("cloak","key2",0,false);
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index 9bbac7aa3..e04563218 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -47,7 +47,7 @@ class ModuleWaitPong : public Module
virtual void OnRehash(const std::string &param)
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
sendsnotice = Conf->ReadFlag("waitpong", "sendsnotice", 0);
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index 89c7f4c62..bf05c272a 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -64,7 +64,7 @@ public:
void InitConf()
{
/* read configuration variables */
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
/* throttle configuration */
seconds = conf->ReadInteger("connflood", "seconds", 0, true);
maxconns = conf->ReadInteger("connflood", "maxconns", 0, true);
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index c823b9c1e..67a7aaca6 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -34,13 +34,13 @@ class ModuleDenyChannels : public Module
ModuleDenyChannels(InspIRCd* Me) : Module::Module(Me)
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
}
virtual void OnRehash(const std::string &param)
{
DELETE(Conf);
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
}
virtual ~ModuleDenyChannels()
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index c54be801e..526316362 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -126,10 +126,10 @@ class ModuleFilter : public Module
{
// reload our config file on rehash - we must destroy and re-allocate the classes
// to call the constructor again and re-read our data.
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader* Conf = new ConfigReader(ServerInstance);
std::string filterfile = Conf->ReadValue("filter","file",0);
// this automatically re-reads the configuration file into the class
- ConfigReader* MyConf = new ConfigReader(filterfile);
+ ConfigReader* MyConf = new ConfigReader(ServerInstance, filterfile);
if ((filterfile == "") || (!MyConf->Verify()))
{
// bail if the user forgot to create a config file
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 452a7114b..46b82b234 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -210,7 +210,7 @@ class ModuleHelpop : public Module
virtual void ReadConfig()
{
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
h_file = conf->ReadValue("helpop", "file", 0);
if (h_file == "")
@@ -220,7 +220,7 @@ class ModuleHelpop : public Module
throw(e);
}
- helpop = new ConfigReader(h_file);
+ helpop = new ConfigReader(ServerInstance, h_file);
if ((helpop->ReadValue("nohelp", "line1", 0) == "") ||
(helpop->ReadValue("nohelpo", "line1", 0) == "") ||
(helpop->ReadValue("start", "line1", 0) == ""))
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index 2fe7ddbb8..d270c74d4 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -49,7 +49,7 @@ class ModuleHostChange : public Module
: Module::Module(Me)
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
OnRehash("");
}
@@ -71,7 +71,7 @@ class ModuleHostChange : public Module
virtual void OnRehash(const std::string &parameter)
{
DELETE(Conf);
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
MySuffix = Conf->ReadValue("host","suffix",0);
for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
{
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index f8178ed3a..1afa3bd09 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -220,7 +220,7 @@ class HttpSocket : public InspSocket
claimed = false;
HTTPRequest httpr(request_type,uri,&headers,this,this->GetIP());
Event e((char*)&httpr, (Module*)HttpModule, "httpd_url");
- e.Send();
+ e.Send(this->Instance);
if (!claimed)
{
@@ -258,7 +258,7 @@ class ModuleHttp : public Module
std::string bindip;
std::string indexfile;
- FileReader index;
+ FileReader* index;
HttpSocket* http;
@@ -266,18 +266,23 @@ class ModuleHttp : public Module
void ReadConfig()
{
- ConfigReader c;
+ ConfigReader c(ServerInstance);
this->host = c.ReadValue("http", "host", 0);
this->bindip = c.ReadValue("http", "ip", 0);
this->port = c.ReadInteger("http", "port", 0, true);
this->indexfile = c.ReadValue("http", "index", 0);
- index.LoadFile(this->indexfile);
+ if (index)
+ {
+ delete index;
+ index = NULL;
+ }
+ index = new FileReader(ServerInstance, this->indexfile);
}
void CreateListener()
{
- http = new HttpSocket(ServerInstance, this->bindip, this->port, true, 0, &index);
+ http = new HttpSocket(ServerInstance, this->bindip, this->port, true, 0, index);
if ((http) && (http->GetState() == I_LISTENING))
{
ServerInstance->AddSocket(http);
@@ -286,7 +291,7 @@ class ModuleHttp : public Module
ModuleHttp(InspIRCd* Me) : Module::Module(Me)
{
-
+ index = NULL;
ReadConfig();
CreateListener();
}
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index a52089a93..7e7c106a1 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -49,7 +49,7 @@ class ModuleHttpStats : public Module
void ReadConfig()
{
- ConfigReader c;
+ ConfigReader c(ServerInstance);
this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0);
}
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 88229c6c1..47266469d 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -181,7 +181,7 @@ class ModuleIdent : public Module
public:
void ReadSettings()
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
IdentTimeout = Conf->ReadInteger("ident","timeout",0,true);
if (!IdentTimeout)
IdentTimeout = 1;
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 25938d0cc..776e1a16d 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -229,7 +229,7 @@ class ModuleMsgFlood : public Module
n.push_back("+b");
n.push_back(user->MakeWildHost());
Event rmode((char *)&n, NULL, "send_mode");
- rmode.Send();
+ rmode.Send(ServerInstance);
}
dest->ServerKickUser(user, "Channel flood triggered (mode +f)", true);
}
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index dc8e1081a..45c5e3959 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -43,7 +43,7 @@ class ModuleOperjoin : public Module
: Module::Module(Me)
{
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
operChan = conf->ReadValue("operjoin", "channel", 0);
}
@@ -55,7 +55,7 @@ class ModuleOperjoin : public Module
virtual void OnRehash(const std::string &parameter)
{
DELETE(conf);
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
}
virtual ~ModuleOperjoin()
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 1909ab5c8..a8f45d6f9 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -26,7 +26,7 @@ class ModuleOperLevels : public Module
{
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
}
virtual ~ModuleOperLevels()
@@ -42,7 +42,7 @@ class ModuleOperLevels : public Module
virtual void OnRehash(const std::string &parameter)
{
DELETE(conf);
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
}
virtual Version GetVersion()
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index b354abf0a..4526b05d3 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -36,7 +36,7 @@ class ModuleModesOnOper : public Module
: Module::Module(Me)
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
}
void Implements(char* List)
@@ -47,7 +47,7 @@ class ModuleModesOnOper : public Module
virtual void OnRehash(const std::string &parameter)
{
DELETE(Conf);
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
}
virtual ~ModuleModesOnOper()
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index b988dd00e..f0457904a 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -13,18 +13,6 @@ using namespace std;
static FileReader* opermotd;
-
-void LoadOperMOTD()
-{
- ConfigReader* conf = new ConfigReader;
- std::string filename;
-
- filename = conf->ReadValue("opermotd","file",0);
-
- opermotd->LoadFile(filename);
- DELETE(conf);
-}
-
void ShowOperMOTD(userrec* user)
{
if(!opermotd->FileSize())
@@ -32,22 +20,18 @@ void ShowOperMOTD(userrec* user)
user->WriteServ(std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
return;
}
-
user->WriteServ(std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
-
for(int i=0; i != opermotd->FileSize(); i++)
{
user->WriteServ(std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
}
-
user->WriteServ(std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
-
}
class cmd_opermotd : public command_t
{
public:
- cmd_opermotd (InspIRCd* Instance) : command_t(Instance,"OPERMOTD", 'o', 0)
+ cmd_opermotd (InspIRCd* Instance) : command_t(Instance,"OPERMOTD", 'o', 0)
{
this->source = "m_opermotd.so";
syntax = "[<servername>]";
@@ -59,62 +43,76 @@ class cmd_opermotd : public command_t
}
};
+
class ModuleOpermotd : public Module
{
- cmd_opermotd* mycommand;
- public:
- ModuleOpermotd(InspIRCd* Me)
- : Module::Module(Me)
- {
-
- mycommand = new cmd_opermotd(ServerInstance);
- ServerInstance->AddCommand(mycommand);
- opermotd = new FileReader();
- LoadOperMOTD();
- }
+ cmd_opermotd* mycommand;
+ public:
- virtual ~ModuleOpermotd()
+ void LoadOperMOTD()
+ {
+ ConfigReader* conf = new ConfigReader(ServerInstance);
+ std::string filename;
+ filename = conf->ReadValue("opermotd","file",0);
+ if (opermotd)
{
+ delete opermotd;
+ opermotd = NULL;
}
+ opermotd = new FileReader(ServerInstance, filename);
+ DELETE(conf);
+ }
+
+ ModuleOpermotd(InspIRCd* Me)
+ : Module::Module(Me)
+ {
+ opermotd = NULL;
+ mycommand = new cmd_opermotd(ServerInstance);
+ ServerInstance->AddCommand(mycommand);
+ opermotd = new FileReader(ServerInstance);
+ LoadOperMOTD();
+ }
- virtual Version GetVersion()
- {
- return Version(1,0,0,1,VF_VENDOR);
- }
+ virtual ~ModuleOpermotd()
+ {
+ }
- void Implements(char* List)
- {
- List[I_OnRehash] = List[I_OnOper] = 1;
- }
+ virtual Version GetVersion()
+ {
+ return Version(1,0,0,1,VF_VENDOR);
+ }
- virtual void OnOper(userrec* user, const std::string &opertype)
- {
- ShowOperMOTD(user);
- }
+ void Implements(char* List)
+ {
+ List[I_OnRehash] = List[I_OnOper] = 1;
+ }
- virtual void OnRehash(const std::string &parameter)
- {
- LoadOperMOTD();
- }
+ virtual void OnOper(userrec* user, const std::string &opertype)
+ {
+ ShowOperMOTD(user);
+ }
+ virtual void OnRehash(const std::string &parameter)
+ {
+ LoadOperMOTD();
+ }
};
class ModuleOpermotdFactory : public ModuleFactory
{
- public:
- ModuleOpermotdFactory()
- {
- }
-
- ~ModuleOpermotdFactory()
- {
- }
+ public:
+ ModuleOpermotdFactory()
+ {
+ }
- virtual Module* CreateModule(InspIRCd* Me)
- {
- return new ModuleOpermotd(Me);
- }
+ ~ModuleOpermotdFactory()
+ {
+ }
+ virtual Module* CreateModule(InspIRCd* Me)
+ {
+ return new ModuleOpermotd(Me);
+ }
};
extern "C" void* init_module(void)
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 7b5349068..c65a992e7 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -50,7 +50,7 @@ class ModuleOverride : public Module
virtual void OnRehash(const std::string &parameter)
{
// on a rehash we delete our classes for good measure and create them again.
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader* Conf = new ConfigReader(ServerInstance);
// re-read our config options on a rehash
NoisyOverride = Conf->ReadFlag("override","noisy",0);
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp
index c232e8a2c..e27a47d04 100644
--- a/src/modules/m_park.cpp
+++ b/src/modules/m_park.cpp
@@ -219,7 +219,7 @@ class ModulePark : public Module
public:
virtual void ReadSettings()
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
ParkMaxTime = Conf->ReadInteger("park","maxtime",0,true);
ConcurrentParks = Conf->ReadInteger("park","maxperip",0,true);
ParkMaxMsgs = Conf->ReadInteger("park","maxmessages",0,true);
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index c1353ef09..035b39a0c 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -83,7 +83,7 @@ class ModuleRandQuote : public Module
: Module::Module(Me)
{
- conf = new ConfigReader;
+ conf = new ConfigReader(ServerInstance);
// Sort the Randomizer thingie..
srand(time(NULL));
@@ -99,7 +99,7 @@ class ModuleRandQuote : public Module
throw(e);
}
- quotes = new FileReader(q_file);
+ quotes = new FileReader(ServerInstance, q_file);
if(!quotes->Exists())
{
RandquoteException e("m_randquote: QuoteFile not Found!! Please check your config - module will not function.");
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index be2364934..e4b149df2 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -263,8 +263,7 @@ class ModuleRemove : public Module
virtual void OnRehash(const std::string&)
{
- ConfigReader conf;
-
+ ConfigReader conf(ServerInstance);
supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0);
}
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index eb1feffa8..50d83617c 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -34,7 +34,7 @@ class ModuleRestrictChans : public Module
void ReadConfig()
{
- ConfigReader* MyConf = new ConfigReader();
+ ConfigReader* MyConf = new ConfigReader(ServerInstance);
allowchans.clear();
for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++)
{
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 4ff327598..57c1ce406 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1935,7 +1935,7 @@ class TreeSocket : public InspSocket
std::deque<std::string> par;
par.push_back(prefix);
par.push_back("");
- DoStats(*(params[0].c_str()), source, results);
+ DoStats(this->Instance, *(params[0].c_str()), source, results);
for (size_t i = 0; i < results.size(); i++)
{
par[1] = "::" + results[i];
@@ -2299,7 +2299,7 @@ class TreeSocket : public InspSocket
unsigned long signon = atoi(params[1].c_str());
unsigned long idle = atoi(params[2].c_str());
if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
- do_whois(who_to_send_to,u,signon,idle,nick_whoised.c_str());
+ do_whois(this->Instance,who_to_send_to,u,signon,idle,nick_whoised.c_str());
}
else
{
@@ -3073,12 +3073,12 @@ class ServernameResolver : public Resolver
* admin takes the tag away and rehashes while the domain is resolving.
*/
Link MyLink;
- public:
+ public:
ServernameResolver(InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD), MyLink(x)
{
/* Nothing in here, folks */
}
-
+
void OnLookupComplete(const std::string &result)
{
/* Initiate the connection, now that we have an IP to use.
@@ -3304,7 +3304,7 @@ std::vector<TreeSocket*> Bindings;
void ReadConfiguration(bool rebind)
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
if (rebind)
{
for (int j =0; j < Conf->Enumerate("bind"); j++)
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 23001d203..741031561 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -84,7 +84,7 @@ class ModuleSWhois : public Module
ModuleSWhois(InspIRCd* Me) : Module::Module(Me)
{
- Conf = new ConfigReader();
+ Conf = new ConfigReader(ServerInstance);
mycommand = new cmd_swhois(ServerInstance);
ServerInstance->AddCommand(mycommand);
}
@@ -92,7 +92,7 @@ class ModuleSWhois : public Module
void OnRehash(const std::string &parameter)
{
DELETE(Conf);
- Conf = new ConfigReader();
+ Conf = new ConfigReader(ServerInstance);
}
void Implements(char* List)
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 30aba781c..a063ce12d 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -184,7 +184,7 @@ class ModuleTimedBans : public Module
n.push_back("-b");
n.push_back(i->mask);
Event rmode((char *)&n, NULL, "send_mode");
- rmode.Send();
+ rmode.Send(ServerInstance);
DELETE(temp);
}
else
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp
index af2dd2bb9..f0ebfe54b 100644
--- a/src/modules/m_vhost.cpp
+++ b/src/modules/m_vhost.cpp
@@ -67,7 +67,7 @@ class ModuleVHost : public Module
ModuleVHost(InspIRCd* Me) : Module::Module(Me)
{
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
mycommand = new cmd_vhost(ServerInstance);
ServerInstance->AddCommand(mycommand);
}
@@ -85,7 +85,7 @@ class ModuleVHost : public Module
virtual void OnRehash(const std::string &parameter)
{
DELETE(Conf);
- Conf = new ConfigReader;
+ Conf = new ConfigReader(ServerInstance);
}
virtual Version GetVersion()