summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-09 11:33:10 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-09 11:33:10 +0000
commit09afa5085614e0224a296abd082fce205003c3fe (patch)
tree444d54deea5f10e3045e0a8a016f9623499f513e
parent6d4128715da39b1e097642a64ee0bd40586d9a38 (diff)
ServerConfig extern moved into class InspIRCd
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4808 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h1
-rw-r--r--include/modules.h8
-rw-r--r--include/typedefs.h1
-rw-r--r--src/channels.cpp4
-rw-r--r--src/cmd_admin.cpp10
-rw-r--r--src/cmd_away.cpp2
-rw-r--r--src/cmd_die.cpp8
-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_kill.cpp8
-rw-r--r--src/cmd_kline.cpp2
-rw-r--r--src/cmd_links.cpp4
-rw-r--r--src/cmd_map.cpp4
-rw-r--r--src/cmd_modules.cpp16
-rw-r--r--src/cmd_nick.cpp4
-rw-r--r--src/cmd_notice.cpp4
-rw-r--r--src/cmd_oper.cpp18
-rw-r--r--src/cmd_ping.cpp4
-rw-r--r--src/cmd_privmsg.cpp4
-rw-r--r--src/cmd_qline.cpp2
-rw-r--r--src/cmd_quit.cpp10
-rw-r--r--src/cmd_rehash.cpp4
-rw-r--r--src/cmd_restart.cpp10
-rw-r--r--src/cmd_stats.cpp28
-rw-r--r--src/cmd_time.cpp4
-rw-r--r--src/cmd_topic.cpp2
-rw-r--r--src/cmd_user.cpp2
-rw-r--r--src/cmd_version.cpp4
-rw-r--r--src/cmd_wallops.cpp2
-rw-r--r--src/cmd_who.cpp4
-rw-r--r--src/cmd_whois.cpp8
-rw-r--r--src/cmd_whowas.cpp6
-rw-r--r--src/cmd_zline.cpp2
-rw-r--r--src/command_parse.cpp11
-rw-r--r--src/commands.cpp17
-rw-r--r--src/configreader.cpp53
-rw-r--r--src/dns.cpp13
-rw-r--r--src/dynamic.cpp6
-rw-r--r--src/helperfuncs.cpp78
-rw-r--r--src/inspircd.cpp18
-rw-r--r--src/inspsocket.cpp1
-rw-r--r--src/message.cpp4
-rw-r--r--src/mode.cpp4
-rw-r--r--src/modes/cmode_b.cpp4
-rw-r--r--src/modes/cmode_h.cpp4
-rw-r--r--src/modes/cmode_o.cpp2
-rw-r--r--src/modes/cmode_v.cpp2
-rw-r--r--src/modules.cpp49
-rw-r--r--src/modules/extra/m_filter_pcre.cpp1
-rw-r--r--src/modules/extra/m_mysql.cpp1
-rw-r--r--src/modules/extra/m_sqloper.cpp1
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp13
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp13
-rw-r--r--src/modules/m_alias.cpp1
-rw-r--r--src/modules/m_banexception.cpp1
-rw-r--r--src/modules/m_blockamsg.cpp1
-rw-r--r--src/modules/m_blockcaps.cpp1
-rw-r--r--src/modules/m_blockcolor.cpp1
-rw-r--r--src/modules/m_cban.cpp19
-rw-r--r--src/modules/m_censor.cpp1
-rw-r--r--src/modules/m_chanfilter.cpp1
-rw-r--r--src/modules/m_chanprotect.cpp1
-rw-r--r--src/modules/m_conn_waitpong.cpp1
-rw-r--r--src/modules/m_denychans.cpp1
-rw-r--r--src/modules/m_devoice.cpp1
-rw-r--r--src/modules/m_filter.cpp1
-rw-r--r--src/modules/m_helpop.cpp1
-rw-r--r--src/modules/m_httpd.cpp1
-rw-r--r--src/modules/m_httpd_stats.cpp5
-rw-r--r--src/modules/m_joinflood.cpp1
-rw-r--r--src/modules/m_knock.cpp1
-rw-r--r--src/modules/m_messageflood.cpp1
-rw-r--r--src/modules/m_noctcp.cpp1
-rw-r--r--src/modules/m_noinvite.cpp1
-rw-r--r--src/modules/m_nokicks.cpp1
-rw-r--r--src/modules/m_nonicks.cpp1
-rw-r--r--src/modules/m_nonotice.cpp1
-rw-r--r--src/modules/m_operchans.cpp1
-rw-r--r--src/modules/m_operjoin.cpp1
-rw-r--r--src/modules/m_operlevels.cpp1
-rw-r--r--src/modules/m_opermd5.cpp1
-rw-r--r--src/modules/m_opermotd.cpp1
-rw-r--r--src/modules/m_opersha256.cpp1
-rw-r--r--src/modules/m_override.cpp1
-rw-r--r--src/modules/m_park.cpp1
-rw-r--r--src/modules/m_randquote.cpp4
-rw-r--r--src/modules/m_redirect.cpp1
-rw-r--r--src/modules/m_restrictchans.cpp1
-rw-r--r--src/modules/m_restrictmsg.cpp1
-rw-r--r--src/modules/m_safelist.cpp3
-rw-r--r--src/modules/m_sajoin.cpp1
-rw-r--r--src/modules/m_samode.cpp1
-rw-r--r--src/modules/m_sanick.cpp1
-rw-r--r--src/modules/m_sapart.cpp1
-rw-r--r--src/modules/m_saquit.cpp1
-rw-r--r--src/modules/m_securelist.cpp3
-rw-r--r--src/modules/m_services.cpp1
-rw-r--r--src/modules/m_services_account.cpp1
-rw-r--r--src/modules/m_showwhois.cpp1
-rw-r--r--src/modules/m_silence.cpp1
-rw-r--r--src/modules/m_spanningtree.cpp8
-rw-r--r--src/modules/m_spy.cpp1
-rw-r--r--src/modules/m_sslmodes.cpp1
-rw-r--r--src/modules/m_stripcolor.cpp1
-rw-r--r--src/modules/m_swhois.cpp1
-rw-r--r--src/modules/m_timedbans.cpp1
-rw-r--r--src/snomasks.cpp1
-rw-r--r--src/socket.cpp5
-rw-r--r--src/userprocess.cpp15
-rw-r--r--src/users.cpp40
-rw-r--r--src/xline.cpp13
113 files changed, 343 insertions, 313 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 0ebad50a8..0b2a2830d 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -103,6 +103,7 @@ class InspIRCd : public classbase
CommandParser* Parser;
SocketEngine* SE;
serverstats* stats;
+ ServerConfig* Config;
DNS* Res;
std::string GetRevision();
diff --git a/include/modules.h b/include/modules.h
index f35aef0b0..f687c9ffe 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -93,9 +93,9 @@ typedef std::map<std::string,Module*> featurelist;
* loaded modules in a readable simple way, e.g.:
* 'FOREACH_MOD(I_OnXonnwxr,OnConnect(user));'
*/
-#define FOREACH_MOD(y,x) if (Config->global_implementation[y] > 0) { \
+#define FOREACH_MOD(y,x) if (ServerInstance->Config->global_implementation[y] > 0) { \
for (int _i = 0; _i <= MODCOUNT; _i++) { \
- if (Config->implement_lists[_i][y]) \
+ if (ServerInstance->Config->implement_lists[_i][y]) \
try \
{ \
modules[_i]->x ; \
@@ -112,10 +112,10 @@ typedef std::map<std::string,Module*> featurelist;
* The first module to return a nonzero result is the value to be accepted,
* and any modules after are ignored.
*/
-#define FOREACH_RESULT(y,x) { if (Config->global_implementation[y] > 0) { \
+#define FOREACH_RESULT(y,x) { if (ServerInstance->Config->global_implementation[y] > 0) { \
MOD_RESULT = 0; \
for (int _i = 0; _i <= MODCOUNT; _i++) { \
- if (Config->implement_lists[_i][y]) {\
+ if (ServerInstance->Config->implement_lists[_i][y]) {\
try \
{ \
int res = modules[_i]->x ; \
diff --git a/include/typedefs.h b/include/typedefs.h
index 4b6d22b98..fc99fd435 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -9,7 +9,6 @@
#include "hashcomp.h"
#include "inspstring.h"
#include "ctables.h"
-#include "inspircd.h"
#include "modules.h"
#include "globals.h"
diff --git a/src/channels.cpp b/src/channels.cpp
index 559b6d3f7..39ae745ad 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -39,7 +39,7 @@ using namespace std;
#include "helperfuncs.h"
#include "typedefs.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
@@ -534,7 +534,7 @@ long chanrec::ServerKickUser(userrec* user, const char* reason, bool triggereven
{
if (user->chans[i]->channel == this)
{
- this->WriteChannelWithServ(Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
+ this->WriteChannelWithServ(ServerInstance->Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
user->chans[i]->uc_modes = 0;
user->chans[i]->channel = NULL;
break;
diff --git a/src/cmd_admin.cpp b/src/cmd_admin.cpp
index 56cb3a4b1..fb370f4e6 100644
--- a/src/cmd_admin.cpp
+++ b/src/cmd_admin.cpp
@@ -20,12 +20,12 @@
#include "helperfuncs.h"
#include "commands/cmd_admin.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
void cmd_admin::Handle (const char** parameters, int pcnt, userrec *user)
{
- user->WriteServ("256 %s :Administrative info for %s",user->nick,Config->ServerName);
- user->WriteServ("257 %s :Name - %s",user->nick,Config->AdminName);
- user->WriteServ("258 %s :Nickname - %s",user->nick,Config->AdminNick);
- user->WriteServ("258 %s :E-Mail - %s",user->nick,Config->AdminEmail);
+ user->WriteServ("256 %s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName);
+ user->WriteServ("257 %s :Name - %s",user->nick,ServerInstance->Config->AdminName);
+ user->WriteServ("258 %s :Nickname - %s",user->nick,ServerInstance->Config->AdminNick);
+ user->WriteServ("258 %s :E-Mail - %s",user->nick,ServerInstance->Config->AdminEmail);
}
diff --git a/src/cmd_away.cpp b/src/cmd_away.cpp
index 627feefc0..f5803f6ae 100644
--- a/src/cmd_away.cpp
+++ b/src/cmd_away.cpp
@@ -23,7 +23,7 @@
#include "helperfuncs.h"
#include "commands/cmd_away.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp
index 27a88fddb..93b9f4987 100644
--- a/src/cmd_die.cpp
+++ b/src/cmd_die.cpp
@@ -23,14 +23,14 @@
#include "helperfuncs.h"
#include "commands/cmd_die.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern std::vector<userrec*> all_opers;
void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
{
- if (!strcmp(parameters[0],Config->diepass))
+ if (!strcmp(parameters[0],ServerInstance->Config->diepass))
{
- log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, Config->DieDelay);
+ log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, ServerInstance->Config->DieDelay);
/* This would just be WriteOpers(), but as we just sleep() and then die then the write buffers never get flushed.
* so we iterate the oper list, writing the message and immediately trying to flush their write buffer.
@@ -47,7 +47,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
}
}
- sleep(Config->DieDelay);
+ sleep(ServerInstance->Config->DieDelay);
Exit(ERROR);
}
else
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index 42fb78363..4c674f262 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -25,7 +25,7 @@
#include "commands/cmd_eline.h"
extern int MODCOUNT;
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 35bd176b2..2b774fb1d 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_eline.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp
index 51becbef5..536a1637f 100644
--- a/src/cmd_info.cpp
+++ b/src/cmd_info.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_info.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index 94ed1d1f3..0255c23dd 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -23,7 +23,7 @@
#include "message.h"
#include "commands/cmd_invite.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index 44ea42277..82a1f088d 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_kill.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
@@ -53,7 +53,7 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
{
// remote kill
WriteOpers("*** Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
- snprintf(killreason, MAXQUIT,"[%s] Killed (%s (%s))", Config->ServerName, user->nick, parameters[1]);
+ snprintf(killreason, MAXQUIT,"[%s] Killed (%s (%s))", ServerInstance->Config->ServerName, user->nick, parameters[1]);
u->WriteCommonExcept("QUIT :%s", killreason);
FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason));
@@ -75,8 +75,8 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
else
{
// local kill
- log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
- user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
+ log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
+ user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
snprintf(killreason,MAXQUIT,"Killed (%s (%s))", user->nick, parameters[1]);
userrec::QuitUser(u, killreason);
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index d5743c4e6..3feb15d10 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -31,7 +31,7 @@
#include "helperfuncs.h"
#include "commands/cmd_kline.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/cmd_links.cpp b/src/cmd_links.cpp
index 633318a14..d8de3c8d6 100644
--- a/src/cmd_links.cpp
+++ b/src/cmd_links.cpp
@@ -22,10 +22,10 @@
#include "helperfuncs.h"
#include "commands/cmd_links.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
void cmd_links::Handle (const char** parameters, int pcnt, userrec *user)
{
- user->WriteServ("364 %s %s %s :0 %s",user->nick,Config->ServerName,Config->ServerName,Config->ServerDesc);
+ user->WriteServ("364 %s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc);
user->WriteServ("365 %s * :End of /LINKS list.",user->nick);
}
diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp
index 862325f4a..e0f77e3b8 100644
--- a/src/cmd_map.cpp
+++ b/src/cmd_map.cpp
@@ -21,13 +21,13 @@
#include "helperfuncs.h"
#include "commands/cmd_map.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
void cmd_map::Handle (const char** parameters, int pcnt, userrec *user)
{
// as with /LUSERS this does nothing without a linking
// module to override its behaviour and display something
// better.
- user->WriteServ("006 %s :%s",user->nick,Config->ServerName);
+ user->WriteServ("006 %s :%s",user->nick,ServerInstance->Config->ServerName);
user->WriteServ("007 %s :End of /MAP",user->nick);
}
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index dc3003a58..7948c0fb9 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -31,7 +31,7 @@
#include "wildcard.h"
#include "commands/cmd_modules.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
@@ -53,7 +53,7 @@ char* itab[] = {
void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
{
- for (unsigned int i = 0; i < Config->module_names.size(); i++)
+ for (unsigned int i = 0; i < ServerInstance->Config->module_names.size(); i++)
{
Version V = modules[i]->GetVersion();
char modulename[MAXBUF];
@@ -69,12 +69,12 @@ void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
strlcat(flagstate,", service provider",MAXBUF);
if (!flagstate[0])
strcpy(flagstate," <no flags>");
- strlcpy(modulename,Config->module_names[i].c_str(),256);
+ strlcpy(modulename,ServerInstance->Config->module_names[i].c_str(),256);
if (*user->oper)
{
if ((pcnt >= 2) && (!strcasecmp(parameters[0],"debug")))
{
- if (match(Config->module_names[i].c_str(),parameters[1]))
+ if (match(ServerInstance->Config->module_names[i].c_str(),parameters[1]))
{
user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
for (int it = 0; itab[it];)
@@ -86,9 +86,9 @@ void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
{
if (itab[it])
{
- if (Config->implement_lists[i][it])
+ if (ServerInstance->Config->implement_lists[i][it])
{
- snprintf(data,MAXBUF,"%s=>%c ",itab[it],(Config->implement_lists[i][it] ? '1' : '0'));
+ snprintf(data,MAXBUF,"%s=>%c ",itab[it],(ServerInstance->Config->implement_lists[i][it] ? '1' : '0'));
strncat(dlist,data,MAXBUF);
}
it++;
@@ -100,8 +100,8 @@ void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("900 %s :=== DEBUG: Implementation counts ===",user->nick);
for (int it = 0; itab[it]; it++)
{
- if (Config->global_implementation[it])
- user->WriteServ("900 %s :%s: %d times",user->nick, itab[it],(int)Config->global_implementation[it]);
+ if (ServerInstance->Config->global_implementation[it])
+ user->WriteServ("900 %s :%s: %d times",user->nick, itab[it],(int)ServerInstance->Config->global_implementation[it]);
}
}
}
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index 6f3329b8c..b0810a2e5 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -28,7 +28,7 @@
#include "hashcomp.h"
#include "commands/cmd_nick.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
@@ -142,7 +142,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
//if (user->dns_done)
// log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
- if (Config->NoUserDns)
+ if (ServerInstance->Config->NoUserDns)
{
user->dns_done = true;
}
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index 08ae3f260..fcadaddaf 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -29,7 +29,7 @@
#include "hashcomp.h"
#include "commands/cmd_notice.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
@@ -55,7 +55,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
parameters[1] = (char*)temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
- if (match(Config->ServerName,servermask))
+ if (match(ServerInstance->Config->ServerName,servermask))
{
NoticeAll(user, true, "%s",parameters[1]);
}
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index abd34f653..7fa598934 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -37,7 +37,7 @@
#include "command_parse.h"
#include "commands/cmd_oper.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
extern FactoryList factory;
@@ -74,24 +74,24 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
snprintf(TheHost,MAXBUF,"%s@%s",user->ident,user->host);
snprintf(TheIP, MAXBUF,"%s@%s",user->ident,user->GetIPString());
- for (int i = 0; i < Config->ConfValueEnum(Config->config_data, "oper"); i++)
+ for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "oper"); i++)
{
- Config->ConfValue(Config->config_data, "oper", "name", i, LoginName, MAXBUF);
- Config->ConfValue(Config->config_data, "oper", "password", i, Password, MAXBUF);
- Config->ConfValue(Config->config_data, "oper", "type", i, OperType, MAXBUF);
- Config->ConfValue(Config->config_data, "oper", "host", i, HostName, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "name", i, LoginName, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "password", i, Password, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "type", i, OperType, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "host", i, HostName, MAXBUF);
if ((!strcmp(LoginName,parameters[0])) && (!operstrcmp(Password,parameters[1])) && (OneOfMatches(TheHost,TheIP,HostName)))
{
fail2 = true;
- for (j =0; j < Config->ConfValueEnum(Config->config_data, "type"); j++)
+ for (j =0; j < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "type"); j++)
{
- Config->ConfValue(Config->config_data, "type","name", j, TypeName, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","name", j, TypeName, MAXBUF);
if (!strcmp(TypeName,OperType))
{
/* found this oper's opertype */
- Config->ConfValue(Config->config_data, "type","host", j, HostName, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","host", j, HostName, MAXBUF);
if (*HostName)
user->ChangeDisplayedHost(HostName);
if (!isnick(TypeName))
diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp
index 48bc8e6b0..a0caeb3cd 100644
--- a/src/cmd_ping.cpp
+++ b/src/cmd_ping.cpp
@@ -20,10 +20,10 @@
#include "helperfuncs.h"
#include "commands/cmd_ping.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
void cmd_ping::Handle (const char** parameters, int pcnt, userrec *user)
{
- user->WriteServ("PONG %s :%s",Config->ServerName,parameters[0]);
+ user->WriteServ("PONG %s :%s",ServerInstance->Config->ServerName,parameters[0]);
}
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 415b6ea39..d11f630a2 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -26,7 +26,7 @@
#include "helperfuncs.h"
#include "commands/cmd_privmsg.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
@@ -53,7 +53,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
parameters[1] = (char*)temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
- if (match(Config->ServerName,servermask))
+ if (match(ServerInstance->Config->ServerName,servermask))
{
ServerPrivmsgAll("%s",parameters[1]);
}
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index 0cbe3d8d0..e38c02880 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -23,7 +23,7 @@
#include "helperfuncs.h"
#include "commands/cmd_qline.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
extern FactoryList factory;
diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp
index b9ca84fef..d8447c1de 100644
--- a/src/cmd_quit.cpp
+++ b/src/cmd_quit.cpp
@@ -35,7 +35,7 @@
#include "socketengine.h"
#include "commands/cmd_quit.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
@@ -66,16 +66,16 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
*/
if (user->fd > -1)
{
- user->Write("ERROR :Closing link (%s@%s) [%s%s]",user->ident,user->host,Config->PrefixQuit,parameters[0]);
- WriteOpers("*** Client exiting: %s!%s@%s [%s%s]",user->nick,user->ident,user->host,Config->PrefixQuit,parameters[0]);
- user->WriteCommonExcept("QUIT :%s%s",Config->PrefixQuit,parameters[0]);
+ user->Write("ERROR :Closing link (%s@%s) [%s%s]",user->ident,user->host,ServerInstance->Config->PrefixQuit,parameters[0]);
+ WriteOpers("*** Client exiting: %s!%s@%s [%s%s]",user->nick,user->ident,user->host,ServerInstance->Config->PrefixQuit,parameters[0]);
+ user->WriteCommonExcept("QUIT :%s%s",ServerInstance->Config->PrefixQuit,parameters[0]);
}
else
{
WriteOpers("*** Client exiting at %s: %s!%s@%s [%s]",user->server,user->nick,user->ident,user->host,parameters[0]);
user->WriteCommonExcept("QUIT :%s",parameters[0]);
}
- FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,std::string(Config->PrefixQuit)+std::string(parameters[0])));
+ FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,std::string(ServerInstance->Config->PrefixQuit)+std::string(parameters[0])));
}
else
diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp
index fa62b7c36..b452a8d0c 100644
--- a/src/cmd_rehash.cpp
+++ b/src/cmd_rehash.cpp
@@ -22,7 +22,7 @@
#include "helperfuncs.h"
#include "commands/cmd_rehash.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
extern FactoryList factory;
@@ -38,7 +38,7 @@ void cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user)
else
{
WriteOpers("%s is rehashing config file %s",user->nick,CleanFilename(CONFIG_FILE));
- Config->Read(false,user);
+ ServerInstance->Config->Read(false,user);
}
FOREACH_MOD(I_OnRehash,OnRehash(parameter));
}
diff --git a/src/cmd_restart.cpp b/src/cmd_restart.cpp
index 2b8a7fc3f..baf5104f9 100644
--- a/src/cmd_restart.cpp
+++ b/src/cmd_restart.cpp
@@ -20,19 +20,19 @@
#include "helperfuncs.h"
#include "commands/cmd_restart.h"
-extern ServerConfig* Config;;
+extern InspIRCd* ServerInstance;;
void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
{
char *argv[32];
log(DEFAULT,"Restart: %s",user->nick);
- if (!strcmp(parameters[0],Config->restartpass))
+ if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
{
WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
- argv[0] = Config->MyExecutable;
+ argv[0] = ServerInstance->Config->MyExecutable;
argv[1] = "-wait";
- if (Config->nofork)
+ if (ServerInstance->Config->nofork)
{
argv[2] = "-nofork";
}
@@ -52,7 +52,7 @@ void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
}
sleep(2);
- execv(Config->MyExecutable,argv);
+ execv(ServerInstance->Config->MyExecutable,argv);
exit(0);
}
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index c4871450e..ce8d22434 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -42,7 +42,7 @@
#include "command_parse.h"
#include "commands/cmd_stats.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
@@ -62,9 +62,9 @@ void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
void DoStats(char statschar, userrec* user, string_list &results)
{
- std::string sn = Config->ServerName;
+ std::string sn = ServerInstance->Config->ServerName;
- if ((*Config->OperOnlyStats) && (strchr(Config->OperOnlyStats,statschar)) && (!*user->oper))
+ if ((*ServerInstance->Config->OperOnlyStats) && (strchr(ServerInstance->Config->OperOnlyStats,statschar)) && (!*user->oper))
{
results.push_back(sn+std::string(" 481 ")+user->nick+" :Permission denied - STATS "+statschar+" is oper-only");
return;
@@ -83,9 +83,9 @@ void DoStats(char statschar, userrec* user, string_list &results)
if (statschar == 'i')
{
int idx = 0;
- for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
+ for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
{
- results.push_back(sn+" 215 "+user->nick+" I * * * "+ConvToStr(MAXCLIENTS)+" "+ConvToStr(idx)+" "+Config->ServerName+" *");
+ results.push_back(sn+" 215 "+user->nick+" I * * * "+ConvToStr(MAXCLIENTS)+" "+ConvToStr(idx)+" "+ServerInstance->Config->ServerName+" *");
idx++;
}
}
@@ -93,7 +93,7 @@ void DoStats(char statschar, userrec* user, string_list &results)
if (statschar == 'y')
{
int idx = 0;
- for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
+ for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
{
results.push_back(sn+" 218 "+user->nick+" Y "+ConvToStr(idx)+" 120 0 "+ConvToStr(i->flood)+" "+ConvToStr(i->registration_timeout));
idx++;
@@ -103,9 +103,9 @@ void DoStats(char statschar, userrec* user, string_list &results)
if (statschar == 'U')
{
char ulined[MAXBUF];
- for (int i = 0; i < Config->ConfValueEnum(Config->config_data, "uline"); i++)
+ for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "uline"); i++)
{
- Config->ConfValue(Config->config_data, "uline","server", i, ulined, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "uline","server", i, ulined, MAXBUF);
results.push_back(sn+" 248 "+user->nick+" U "+std::string(ulined));
}
}
@@ -170,7 +170,7 @@ void DoStats(char statschar, userrec* user, string_list &results)
results.push_back(sn+" 249 "+user->nick+" :Users(HASH_MAP) "+ConvToStr(clientlist.size())+" ("+ConvToStr(clientlist.size()*sizeof(userrec))+" bytes, "+ConvToStr(clientlist.bucket_count())+" buckets)");
results.push_back(sn+" 249 "+user->nick+" :Channels(HASH_MAP) "+ConvToStr(chanlist.size())+" ("+ConvToStr(chanlist.size()*sizeof(chanrec))+" bytes, "+ConvToStr(chanlist.bucket_count())+" buckets)");
results.push_back(sn+" 249 "+user->nick+" :Commands(VECTOR) "+ConvToStr(ServerInstance->Parser->cmdlist.size())+" ("+ConvToStr(ServerInstance->Parser->cmdlist.size()*sizeof(command_t))+" bytes)");
- results.push_back(sn+" 249 "+user->nick+" :MOTD(VECTOR) "+ConvToStr(Config->MOTD.size())+", RULES(VECTOR) "+ConvToStr(Config->RULES.size()));
+ results.push_back(sn+" 249 "+user->nick+" :MOTD(VECTOR) "+ConvToStr(ServerInstance->Config->MOTD.size())+", RULES(VECTOR) "+ConvToStr(ServerInstance->Config->RULES.size()));
results.push_back(sn+" 249 "+user->nick+" :Modules(VECTOR) "+ConvToStr(modules.size())+" ("+ConvToStr(modules.size()*sizeof(Module))+")");
results.push_back(sn+" 249 "+user->nick+" :ClassFactories(VECTOR) "+ConvToStr(factory.size())+" ("+ConvToStr(factory.size()*sizeof(ircd_module))+")");
if (!getrusage(RUSAGE_SELF,&R))
@@ -198,14 +198,14 @@ void DoStats(char statschar, userrec* user, string_list &results)
/* stats o */
if (statschar == 'o')
{
- for (int i = 0; i < Config->ConfValueEnum(Config->config_data, "oper"); i++)
+ for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "oper"); i++)
{
char LoginName[MAXBUF];
char HostName[MAXBUF];
char OperType[MAXBUF];
- Config->ConfValue(Config->config_data, "oper","name", i, LoginName, MAXBUF);
- Config->ConfValue(Config->config_data, "oper","host", i, HostName, MAXBUF);
- Config->ConfValue(Config->config_data, "oper","type", i, OperType, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper","name", i, LoginName, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper","host", i, HostName, MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper","type", i, OperType, MAXBUF);
results.push_back(sn+" 243 "+user->nick+" O "+HostName+" * "+LoginName+" "+OperType+" 0");
}
}
@@ -263,7 +263,7 @@ void DoStats(char statschar, userrec* user, string_list &results)
}
results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
- WriteOpers("*** Notice: %s '%c' requested by %s (%s@%s)",(!strcmp(user->server,Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick,user->ident,user->host);
+ WriteOpers("*** Notice: %s '%c' requested by %s (%s@%s)",(!strcmp(user->server,ServerInstance->Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick,user->ident,user->host);
return;
}
diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp
index 97904ba8a..f87f398c8 100644
--- a/src/cmd_time.cpp
+++ b/src/cmd_time.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_time.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern time_t TIME;
void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
@@ -34,6 +34,6 @@ void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
snprintf(tms,26,"%s",asctime(timeinfo));
tms[24] = 0;
- user->WriteServ("391 %s %s :%s",user->nick,Config->ServerName,tms);
+ user->WriteServ("391 %s %s :%s",user->nick,ServerInstance->Config->ServerName,tms);
}
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index 1d4d040f5..913b80dd3 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -23,7 +23,7 @@
#include "commands/cmd_topic.h"
#include "helperfuncs.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern time_t TIME;
extern ModuleList modules;
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 7f00a3c67..cd7f26d09 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -22,7 +22,7 @@
#include "helperfuncs.h"
#include "commands/cmd_user.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
extern FactoryList factory;
diff --git a/src/cmd_version.cpp b/src/cmd_version.cpp
index c5c4a13ee..3d98491f1 100644
--- a/src/cmd_version.cpp
+++ b/src/cmd_version.cpp
@@ -21,12 +21,12 @@
#include "helperfuncs.h"
#include "commands/cmd_version.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
void cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
{
- std::stringstream out(Config->data005);
+ std::stringstream out(ServerInstance->Config->data005);
std::string token = "";
std::string line5 = "";
int token_counter = 0;
diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp
index a30ab0762..752d14f41 100644
--- a/src/cmd_wallops.cpp
+++ b/src/cmd_wallops.cpp
@@ -23,7 +23,7 @@
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
-extern ServerConfig* Config;
+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 bb4a37234..0a6637242 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -23,7 +23,7 @@
#include "wildcard.h"
#include "commands/cmd_who.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern user_hash clientlist;
extern chan_hash chanlist;
extern std::vector<userrec*> all_opers;
@@ -228,7 +228,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
}
}
/* Send the results out */
- if ((whoresults.size() < (size_t)Config->MaxWhoResults) && (!opt_unlimit))
+ if ((whoresults.size() < (size_t)ServerInstance->Config->MaxWhoResults) && (!opt_unlimit))
{
for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
user->WriteServ(*n);
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp
index 398f2bc31..600751585 100644
--- a/src/cmd_whois.cpp
+++ b/src/cmd_whois.cpp
@@ -23,7 +23,7 @@
#include "helperfuncs.h"
#include "commands/cmd_whois.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
@@ -62,9 +62,9 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
user->WriteServ("319 %s %s :%s",user->nick, dest->nick, cl.c_str());
}
}
- if (*Config->HideWhoisServer && !(*user->oper))
+ if (*ServerInstance->Config->HideWhoisServer && !(*user->oper))
{
- user->WriteServ("312 %s %s %s :%s",user->nick, dest->nick, Config->HideWhoisServer, Config->Network);
+ user->WriteServ("312 %s %s %s :%s",user->nick, dest->nick, ServerInstance->Config->HideWhoisServer, ServerInstance->Config->Network);
}
else
{
@@ -76,7 +76,7 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
}
if (*dest->oper)
{
- user->WriteServ("313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),Spacify(dest->oper), Config->Network);
+ user->WriteServ("313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),Spacify(dest->oper), ServerInstance->Config->Network);
}
if ((!signon) && (!idle))
{
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index 39c028618..b4292857c 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -21,7 +21,7 @@
#include "helperfuncs.h"
#include "commands/cmd_whowas.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern irc::whowas::whowas_users whowas;
void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
@@ -55,8 +55,8 @@ void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
if(*user->oper)
user->WriteServ("379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host);
- if(*Config->HideWhoisServer && !(*user->oper))
- user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], Config->HideWhoisServer, b);
+ if(*ServerInstance->Config->HideWhoisServer && !(*user->oper))
+ user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], ServerInstance->Config->HideWhoisServer, b);
else
user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], u->server, b);
}
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 9ae90a75d..cb838b2de 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -24,7 +24,7 @@
#include "helperfuncs.h"
#include "commands/cmd_zline.h"
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
extern FactoryList factory;
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index bcea36439..25a3ca192 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -53,11 +53,9 @@ extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
-extern std::vector<InspSocket*> module_sockets;
extern std::vector<userrec*> local_users;
extern int MODCOUNT;
-extern InspSocket* socket_ref[MAX_DESCRIPTORS];
extern time_t TIME;
// This table references users by file descriptor.
@@ -66,7 +64,6 @@ extern time_t TIME;
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
extern Server* MyServer;
-extern ServerConfig *Config;
extern user_hash clientlist;
extern chan_hash chanlist;
@@ -85,7 +82,7 @@ cmd_pass* command_pass;
* Therefore, we need to deal with both lists concurrently. The first instance of this method does that by creating
* two instances of irc::commasepstream and reading them both together until the first runs out of tokens.
* The second version is much simpler and just has the one stream to read, and is used in NAMES, WHOIS, PRIVMSG etc.
- * Both will only parse until they reach Config->MaxTargets number of targets, to stop abuse via spam.
+ * Both will only parse until they reach ServerInstance->Config->MaxTargets number of targets, to stop abuse via spam.
*/
int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** parameters, int pcnt, unsigned int splithere, unsigned int extra)
{
@@ -106,7 +103,7 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
* which called us, for every parameter pair until there are
* no more left to parse.
*/
- while (((item = items1.GetToken()) != "") && (max++ < Config->MaxTargets))
+ while (((item = items1.GetToken()) != "") && (max++ < ServerInstance->Config->MaxTargets))
{
std::string extrastuff = items2.GetToken();
parameters[splithere] = item.c_str();
@@ -133,7 +130,7 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
* Each token we parse out, call the command handler that called us
* with it
*/
- while (((item = items1.GetToken()) != "") && (max++ < Config->MaxTargets))
+ while (((item = items1.GetToken()) != "") && (max++ < ServerInstance->Config->MaxTargets))
{
parameters[splithere] = item.c_str();
CommandObj->Handle(parameters,pcnt,user);
@@ -247,7 +244,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
{
user->WriteServ("461 %s %s :Not enough parameters.", user->nick, command.c_str());
/* If syntax is given, display this as the 461 reply */
- if ((Config->SyntaxHints) && (cm->second->syntax.length()))
+ if ((ServerInstance->Config->SyntaxHints) && (cm->second->syntax.length()))
user->WriteServ("304 %s :SYNTAX %s %s", user->nick, cm->second->command.c_str(), cm->second->syntax.c_str());
return;
}
diff --git a/src/commands.cpp b/src/commands.cpp
index db30cace9..b8788864b 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -50,7 +50,6 @@
#include "typedefs.h"
#include "command_parse.h"
-extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
@@ -82,7 +81,7 @@ void split_chlist(userrec* user, userrec* dest, const std::string &cl)
std::ostringstream prefix;
std::string::size_type start, pos, length;
- prefix << ":" << Config->ServerName << " 319 " << user->nick << " " << dest->nick << " :";
+ prefix << ":" << ServerInstance->Config->ServerName << " 319 " << user->nick << " " << dest->nick << " :";
line = prefix.str();
for (start = 0; (pos = cl.find(' ', start)) != std::string::npos; start = pos+1)
@@ -120,7 +119,7 @@ bool is_uline(const char* server)
if (!*server)
return true;
- return (find(Config->ulines.begin(),Config->ulines.end(),server) != Config->ulines.end());
+ return (find(ServerInstance->Config->ulines.begin(),ServerInstance->Config->ulines.end(),server) != ServerInstance->Config->ulines.end());
}
int operstrcmp(const char* data,const char* input)
@@ -203,10 +202,10 @@ bool host_matches_everyone(const std::string &mask, userrec* user)
char itrigger[MAXBUF];
long matches = 0;
- if (!Config->ConfValue(Config->config_data, "insane","trigger", 0, itrigger, MAXBUF))
+ if (!ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "insane","trigger", 0, itrigger, MAXBUF))
strlcpy(itrigger,"95.5",MAXBUF);
- if (Config->ConfValueBool(Config->config_data, "insane","hostmasks", 0))
+ if (ServerInstance->Config->ConfValueBool(ServerInstance->Config->config_data, "insane","hostmasks", 0))
return false;
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
@@ -231,10 +230,10 @@ bool ip_matches_everyone(const std::string &ip, userrec* user)
char itrigger[MAXBUF];
long matches = 0;
- if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
+ if (!ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
strlcpy(itrigger,"95.5",MAXBUF);
- if (Config->ConfValueBool(Config->config_data, "insane","ipmasks",0))
+ if (ServerInstance->Config->ConfValueBool(ServerInstance->Config->config_data, "insane","ipmasks",0))
return false;
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
@@ -257,10 +256,10 @@ bool nick_matches_everyone(const std::string &nick, userrec* user)
char itrigger[MAXBUF];
long matches = 0;
- if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
+ if (!ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
strlcpy(itrigger,"95.5",MAXBUF);
- if (Config->ConfValueBool(Config->config_data, "insane","nickmasks",0))
+ if (ServerInstance->Config->ConfValueBool(ServerInstance->Config->config_data, "insane","nickmasks",0))
return false;
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 4811a2547..068e4d4ee 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -27,7 +27,6 @@
#include "userprocess.h"
#include "xline.h"
-extern ServerConfig *Config;
extern InspIRCd* ServerInstance;
extern time_t TIME;
@@ -97,7 +96,7 @@ bool ServerConfig::DelIOHook(int port)
bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
{
- int count = ConfValueEnum(Config->config_data, tag);
+ int count = ConfValueEnum(this->config_data, tag);
if (count > 1)
{
@@ -284,20 +283,20 @@ bool ValidateServerName(const char* tag, const char* value, void* data)
bool ValidateNetBufferSize(const char* tag, const char* value, void* data)
{
- if ((!Config->NetBufferSize) || (Config->NetBufferSize > 65535) || (Config->NetBufferSize < 1024))
+ if ((!ServerInstance->Config->NetBufferSize) || (ServerInstance->Config->NetBufferSize > 65535) || (ServerInstance->Config->NetBufferSize < 1024))
{
log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
- Config->NetBufferSize = 10240;
+ ServerInstance->Config->NetBufferSize = 10240;
}
return true;
}
bool ValidateMaxWho(const char* tag, const char* value, void* data)
{
- if ((!Config->MaxWhoResults) || (Config->MaxWhoResults > 65535) || (Config->MaxWhoResults < 1))
+ if ((!ServerInstance->Config->MaxWhoResults) || (ServerInstance->Config->MaxWhoResults > 65535) || (ServerInstance->Config->MaxWhoResults < 1))
{
log(DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128.");
- Config->MaxWhoResults = 128;
+ ServerInstance->Config->MaxWhoResults = 128;
}
return true;
}
@@ -305,32 +304,32 @@ bool ValidateMaxWho(const char* tag, const char* value, void* data)
bool ValidateLogLevel(const char* tag, const char* value, void* data)
{
const char* dbg = (const char*)data;
- Config->LogLevel = DEFAULT;
+ ServerInstance->Config->LogLevel = DEFAULT;
if (!strcmp(dbg,"debug"))
{
- Config->LogLevel = DEBUG;
- Config->debugging = 1;
+ ServerInstance->Config->LogLevel = DEBUG;
+ ServerInstance->Config->debugging = 1;
}
else if (!strcmp(dbg,"verbose"))
- Config->LogLevel = VERBOSE;
+ ServerInstance->Config->LogLevel = VERBOSE;
else if (!strcmp(dbg,"default"))
- Config->LogLevel = DEFAULT;
+ ServerInstance->Config->LogLevel = DEFAULT;
else if (!strcmp(dbg,"sparse"))
- Config->LogLevel = SPARSE;
+ ServerInstance->Config->LogLevel = SPARSE;
else if (!strcmp(dbg,"none"))
- Config->LogLevel = NONE;
+ ServerInstance->Config->LogLevel = NONE;
return true;
}
bool ValidateMotd(const char* tag, const char* value, void* data)
{
- readfile(Config->MOTD,Config->motd);
+ readfile(ServerInstance->Config->MOTD,ServerInstance->Config->motd);
return true;
}
bool ValidateRules(const char* tag, const char* value, void* data)
{
- readfile(Config->RULES,Config->rules);
+ readfile(ServerInstance->Config->RULES,ServerInstance->Config->rules);
return true;
}
@@ -339,7 +338,7 @@ bool ValidateRules(const char* tag, const char* value, void* data)
bool InitConnect(const char* tag)
{
log(DEFAULT,"Reading connect classes...");
- Config->Classes.clear();
+ ServerInstance->Config->Classes.clear();
return true;
}
@@ -393,13 +392,13 @@ bool DoConnect(const char* tag, char** entries, void** values, int* types)
c.registration_timeout = 90;
if (c.pingtime == 0)
c.pingtime = 120;
- Config->Classes.push_back(c);
+ ServerInstance->Config->Classes.push_back(c);
}
else
{
c.host = deny;
c.type = CC_DENY;
- Config->Classes.push_back(c);
+ ServerInstance->Config->Classes.push_back(c);
log(DEBUG,"Read connect class type DENY, host=%s",deny);
}
@@ -418,7 +417,7 @@ bool DoneConnect(const char* tag)
*/
bool InitULine(const char* tag)
{
- Config->ulines.clear();
+ ServerInstance->Config->ulines.clear();
return true;
}
@@ -428,7 +427,7 @@ bool DoULine(const char* tag, char** entries, void** values, int* types)
{
char* server = (char*)values[0];
log(DEBUG,"Read ULINE '%s'",server);
- Config->ulines.push_back(server);
+ ServerInstance->Config->ulines.push_back(server);
return true;
}
@@ -447,7 +446,7 @@ bool InitModule(const char* tag)
new_module_names.clear();
added_modules.clear();
removed_modules.clear();
- for (std::vector<std::string>::iterator t = Config->module_names.begin(); t != Config->module_names.end(); t++)
+ for (std::vector<std::string>::iterator t = ServerInstance->Config->module_names.begin(); t != ServerInstance->Config->module_names.end(); t++)
{
old_module_names.push_back(*t);
}
@@ -502,7 +501,7 @@ bool DoneModule(const char* tag)
*/
bool InitMaxBans(const char* tag)
{
- Config->maxbans.clear();
+ ServerInstance->Config->maxbans.clear();
return true;
}
@@ -512,7 +511,7 @@ bool DoMaxBans(const char* tag, char** entries, void** values, int* types)
{
char* channel = (char*)values[0];
int* limit = (int*)values[1];
- Config->maxbans[channel] = *limit;
+ ServerInstance->Config->maxbans[channel] = *limit;
return true;
}
@@ -643,7 +642,7 @@ void ServerConfig::Read(bool bail, userrec* user)
if (this->LoadConf(newconfig, CONFIG_FILE, errstr))
{
/* If we succeeded, set the ircd config to the new one */
- Config->config_data = newconfig;
+ this->config_data = newconfig;
/* int c = 1;
std::string last;
@@ -678,8 +677,8 @@ void ServerConfig::Read(bool bail, userrec* user)
unsigned int prefixlen;
start = 0;
- /* ":Config->ServerName NOTICE user->nick :" */
- prefixlen = strlen(Config->ServerName) + strlen(user->nick) + 11;
+ /* ":ServerInstance->Config->ServerName NOTICE user->nick :" */
+ prefixlen = strlen(this->ServerName) + strlen(user->nick) + 11;
if (user)
{
@@ -793,7 +792,7 @@ void ServerConfig::Read(bool bail, userrec* user)
delete[] data[n];
// write once here, to try it out and make sure its ok
- ServerInstance->WritePID(Config->PID);
+ ServerInstance->WritePID(this->PID);
log(DEFAULT,"Done reading configuration file, InspIRCd is now starting.");
diff --git a/src/dns.cpp b/src/dns.cpp
index cbe56337d..5e6499dc0 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -45,7 +45,6 @@ using namespace std;
/* We need these */
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
/* Master file descriptor */
int DNS::MasterSocket;
@@ -258,10 +257,10 @@ DNS::DNS()
memset(&myserver,0,sizeof(insp_inaddr));
/* Convert the nameserver address into an insp_inaddr */
- if (insp_aton(Config->DNSServer,&addr) > 0)
+ if (insp_aton(ServerInstance->Config->DNSServer,&addr) > 0)
{
memcpy(&myserver,&addr,sizeof(insp_inaddr));
- if ((strstr(Config->DNSServer,"::ffff:") == (char*)&Config->DNSServer) || (strstr(Config->DNSServer,"::FFFF:") == (char*)&Config->DNSServer))
+ if ((strstr(ServerInstance->Config->DNSServer,"::ffff:") == (char*)&ServerInstance->Config->DNSServer) || (strstr(ServerInstance->Config->DNSServer,"::FFFF:") == (char*)&ServerInstance->Config->DNSServer))
{
/* These dont come back looking like they did when they went in.
* We're forced to turn some checks off.
@@ -272,11 +271,11 @@ DNS::DNS()
log(DEFAULT," to a true IPv6 environment.");
this->ip6munge = true;
}
- log(DEBUG,"Added nameserver '%s'",Config->DNSServer);
+ log(DEBUG,"Added nameserver '%s'",ServerInstance->Config->DNSServer);
}
else
{
- log(DEBUG,"GACK! insp_aton says the nameserver '%s' is invalid!",Config->DNSServer);
+ log(DEBUG,"GACK! insp_aton says the nameserver '%s' is invalid!",ServerInstance->Config->DNSServer);
}
/* Initialize mastersocket */
@@ -571,9 +570,9 @@ DNSResult DNS::GetResult()
*/
if (!ip6munge)
{
- if ((port_from != DNS::QUERY_PORT) || (strcasecmp(ipaddr_from, Config->DNSServer)))
+ if ((port_from != DNS::QUERY_PORT) || (strcasecmp(ipaddr_from, ServerInstance->Config->DNSServer)))
{
- log(DEBUG,"port %d is not 53, or %s is not %s",port_from, ipaddr_from, Config->DNSServer);
+ log(DEBUG,"port %d is not 53, or %s is not %s",port_from, ipaddr_from, ServerInstance->Config->DNSServer);
return std::make_pair(-1,"");
}
}
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index d38405d48..c75371a39 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -33,7 +33,7 @@ using namespace std;
#include <sys/types.h>
#include <stdio.h>
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
DLLManager::DLLManager(const char *fname)
{
@@ -73,7 +73,7 @@ DLLManager::DLLManager(const char *fname)
log(DEBUG,"Opened module file %s",fname);
char tmpfile_template[255];
char buffer[65536];
- snprintf(tmpfile_template, 255, "%s/inspircd_file.so.%d.XXXXXXXXXX",Config->TempDir,getpid());
+ snprintf(tmpfile_template, 255, "%s/inspircd_file.so.%d.XXXXXXXXXX",ServerInstance->Config->TempDir,getpid());
int fd = mkstemp(tmpfile_template);
if (fd == -1)
{
@@ -115,7 +115,7 @@ DLLManager::DLLManager(const char *fname)
log(DEBUG,"Finished loading '%s': %0x",tmpfile_template, h);
// We can delete the tempfile once it's loaded, leaving just the inode.
- if (!err && !Config->debugging)
+ if (!err && !ServerInstance->Config->debugging)
{
log(DEBUG,"Deleteting %s",tmpfile_template);
if (unlink(tmpfile_template) == -1)
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index e9d4e774f..b25370df6 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -46,7 +46,6 @@
extern int MODCOUNT;
extern ModuleList modules;
-extern ServerConfig *Config;
extern InspIRCd* ServerInstance;
extern time_t TIME;
extern char lowermap[255];
@@ -71,8 +70,11 @@ void do_log(int level, const char *text, ...)
va_list argsPtr;
char textbuffer[MAXBUF];
+ if (!ServerInstance || !ServerInstance->Config)
+ return;
+
/* If we were given -debug we output all messages, regardless of configured loglevel */
- if ((level < Config->LogLevel) && !Config->forcedebug)
+ if ((level < ServerInstance->Config->LogLevel) && !ServerInstance->Config->forcedebug)
return;
if (TIME != LAST)
@@ -84,20 +86,20 @@ void do_log(int level, const char *text, ...)
LAST = TIME;
}
- if (Config->log_file)
+ if (ServerInstance->Config->log_file)
{
va_start(argsPtr, text);
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- if (Config->writelog)
+ if (ServerInstance->Config->writelog)
{
- fprintf(Config->log_file,"%s %s\n",TIMESTR,textbuffer);
- fflush(Config->log_file);
+ fprintf(ServerInstance->Config->log_file,"%s %s\n",TIMESTR,textbuffer);
+ fflush(ServerInstance->Config->log_file);
}
}
- if (Config->nofork)
+ if (ServerInstance->Config->nofork)
{
printf("%s %s\n", TIMESTR, textbuffer);
}
@@ -159,7 +161,7 @@ std::string GetServerDescription(const char* servername)
else
{
// not a remote server that can be found, it must be me.
- return Config->ServerDesc;
+ return ServerInstance->Config->ServerDesc;
}
}
@@ -223,7 +225,7 @@ void ServerNoticeAll(char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s",Config->ServerName,textbuffer);
+ snprintf(formatbuffer,MAXBUF,"NOTICE $%s :%s",ServerInstance->Config->ServerName,textbuffer);
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
@@ -244,7 +246,7 @@ void ServerPrivmsgAll(char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s",Config->ServerName,textbuffer);
+ snprintf(formatbuffer,MAXBUF,"PRIVMSG $%s :%s",ServerInstance->Config->ServerName,textbuffer);
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
@@ -406,7 +408,7 @@ chanrec* FindChan(const char* chan)
long GetMaxBans(char* name)
{
std::string x;
- for (std::map<std::string,int>::iterator n = Config->maxbans.begin(); n != Config->maxbans.end(); n++)
+ for (std::map<std::string,int>::iterator n = ServerInstance->Config->maxbans.begin(); n != ServerInstance->Config->maxbans.end(); n++)
{
x = n->first;
if (match(name,x.c_str()))
@@ -612,7 +614,7 @@ int usercount(chanrec *c)
*/
ConnectClass GetClass(userrec *user)
{
- for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
+ for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
{
if ((match(user->GetIPString(),i->host.c_str(),true)) || (match(user->host,i->host.c_str())))
{
@@ -620,7 +622,7 @@ ConnectClass GetClass(userrec *user)
}
}
- return *(Config->Classes.begin());
+ return *(ServerInstance->Config->Classes.begin());
}
/*
@@ -759,32 +761,32 @@ long local_count()
void ShowMOTD(userrec *user)
{
- if (!Config->MOTD.size())
+ if (!ServerInstance->Config->MOTD.size())
{
user->WriteServ("422 %s :Message of the day file is missing.",user->nick);
return;
}
- user->WriteServ("375 %s :%s message of the day", user->nick, Config->ServerName);
+ user->WriteServ("375 %s :%s message of the day", user->nick, ServerInstance->Config->ServerName);
- for (unsigned int i = 0; i < Config->MOTD.size(); i++)
- user->WriteServ("372 %s :- %s",user->nick,Config->MOTD[i].c_str());
+ for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++)
+ user->WriteServ("372 %s :- %s",user->nick,ServerInstance->Config->MOTD[i].c_str());
user->WriteServ("376 %s :End of message of the day.", user->nick);
}
void ShowRULES(userrec *user)
{
- if (!Config->RULES.size())
+ if (!ServerInstance->Config->RULES.size())
{
user->WriteServ("NOTICE %s :Rules file is missing.",user->nick);
return;
}
- user->WriteServ("NOTICE %s :%s rules",user->nick,Config->ServerName);
+ user->WriteServ("NOTICE %s :%s rules",user->nick,ServerInstance->Config->ServerName);
- for (unsigned int i = 0; i < Config->RULES.size(); i++)
- user->WriteServ("NOTICE %s :%s",user->nick,Config->RULES[i].c_str());
+ for (unsigned int i = 0; i < ServerInstance->Config->RULES.size(); i++)
+ user->WriteServ("NOTICE %s :%s",user->nick,ServerInstance->Config->RULES[i].c_str());
- user->WriteServ("NOTICE %s :End of %s rules.",user->nick,Config->ServerName);
+ user->WriteServ("NOTICE %s :End of %s rules.",user->nick,ServerInstance->Config->ServerName);
}
// this returns 1 when all modules are satisfied that the user should be allowed onto the irc server
@@ -792,12 +794,12 @@ void ShowRULES(userrec *user)
// registration timeout maximum seconds)
bool AllModulesReportReady(userrec* user)
{
- if (!Config->global_implementation[I_OnCheckReady])
+ if (!ServerInstance->Config->global_implementation[I_OnCheckReady])
return true;
for (int i = 0; i <= MODCOUNT; i++)
{
- if (Config->implement_lists[i][I_OnCheckReady])
+ if (ServerInstance->Config->implement_lists[i][I_OnCheckReady])
{
int res = modules[i]->OnCheckReady(user);
if (!res)
@@ -1020,29 +1022,29 @@ void OpenLog(char** argv, int argc)
{
if (!*LOG_FILE)
{
- if (Config->logpath == "")
+ if (ServerInstance->Config->logpath == "")
{
- Config->logpath = GetFullProgDir(argv,argc) + "/ircd.log";
+ ServerInstance->Config->logpath = GetFullProgDir(argv,argc) + "/ircd.log";
}
}
else
{
- Config->log_file = fopen(LOG_FILE,"a+");
+ ServerInstance->Config->log_file = fopen(LOG_FILE,"a+");
- if (!Config->log_file)
+ if (!ServerInstance->Config->log_file)
{
- printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str());
+ printf("ERROR: Could not write to logfile %s, bailing!\n\n",ServerInstance->Config->logpath.c_str());
Exit(ERROR);
}
return;
}
- Config->log_file = fopen(Config->logpath.c_str(),"a+");
+ ServerInstance->Config->log_file = fopen(ServerInstance->Config->logpath.c_str(),"a+");
- if (!Config->log_file)
+ if (!ServerInstance->Config->log_file)
{
- printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str());
+ printf("ERROR: Could not write to logfile %s, bailing!\n\n",ServerInstance->Config->logpath.c_str());
Exit(ERROR);
}
}
@@ -1059,10 +1061,10 @@ void CheckRoot()
void CheckDie()
{
- if (*Config->DieValue)
+ if (*ServerInstance->Config->DieValue)
{
- printf("WARNING: %s\n\n",Config->DieValue);
- log(DEFAULT,"Uh-Oh, somebody didn't read their config file: '%s'",Config->DieValue);
+ printf("WARNING: %s\n\n",ServerInstance->Config->DieValue);
+ log(DEFAULT,"Uh-Oh, somebody didn't read their config file: '%s'",ServerInstance->Config->DieValue);
Exit(ERROR);
}
}
@@ -1071,12 +1073,12 @@ void CheckDie()
void LoadAllModules(InspIRCd* ServerInstance)
{
char configToken[MAXBUF];
- Config->module_names.clear();
+ ServerInstance->Config->module_names.clear();
MODCOUNT = -1;
- for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "module"); count++)
+ for (int count = 0; count < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "module"); count++)
{
- Config->ConfValue(Config->config_data, "module","name",count,configToken,MAXBUF);
+ ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "module","name",count,configToken,MAXBUF);
printf("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken);
if (!ServerInstance->LoadModule(configToken))
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index a9d4cfb19..c92e862b0 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -89,7 +89,6 @@ time_t TIME = time(NULL), OLDTIME = time(NULL);
// by an integer, meaning there is no need for a scan/search operation.
userrec* fd_ref_table[MAX_DESCRIPTORS];
Server* MyServer = new Server;
-ServerConfig *Config = new ServerConfig;
user_hash clientlist;
chan_hash chanlist;
servernamelist servernames;
@@ -123,8 +122,8 @@ bool FindServerName(const std::string &servername)
void Exit(int status)
{
- if (Config->log_file)
- fclose(Config->log_file);
+ if (ServerInstance->Config->log_file)
+ fclose(ServerInstance->Config->log_file);
send_error("Server shutdown.");
exit (status);
}
@@ -140,8 +139,8 @@ void InspIRCd::Start()
void Killed(int status)
{
- if (Config->log_file)
- fclose(Config->log_file);
+ if (ServerInstance->Config->log_file)
+ fclose(ServerInstance->Config->log_file);
send_error("Server terminated.");
exit(status);
}
@@ -149,9 +148,9 @@ void Killed(int status)
void Rehash(int status)
{
WriteOpers("Rehashing config file %s due to SIGHUP",CleanFilename(CONFIG_FILE));
- fclose(Config->log_file);
+ fclose(ServerInstance->Config->log_file);
OpenLog(NULL,0);
- Config->Read(false,NULL);
+ ServerInstance->Config->Read(false,NULL);
FOREACH_MOD(I_OnRehash,OnRehash(""));
}
@@ -234,7 +233,8 @@ void InspIRCd::MakeLowerMap()
InspIRCd::InspIRCd(int argc, char** argv)
{
bool SEGVHandler = false;
-
+ this->Config = new ServerConfig;
+ ServerInstance = this;
this->Start();
module_sockets.clear();
this->startup_time = time(NULL);
@@ -907,8 +907,6 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
int InspIRCd::Run()
{
- /* Until THIS point, ServerInstance == NULL */
-
this->Res = new DNS();
LoadAllModules(this);
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index fcd1c3a5a..5c8607f7d 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -30,7 +30,6 @@
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
extern time_t TIME;
extern Server* MyServer;
diff --git a/src/message.cpp b/src/message.cpp
index 455c9754f..f2a41a59b 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -46,7 +46,7 @@ extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern time_t TIME;
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
/* verify that a user's ident and nickname is valid */
@@ -200,7 +200,7 @@ std::string chlist(userrec *user,userrec* source)
* If the channel is NOT private/secret OR the user shares a common channel
* If the user is an oper, and the <options:operspywhois> option is set.
*/
- if ((source == user) || (*source->oper && Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET])) || (rec->channel->HasUser(source))))
+ if ((source == user) || (*source->oper && ServerInstance->Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET])) || (rec->channel->HasUser(source))))
{
list.append(cmode(user, rec->channel)).append(rec->channel->name).append(" ");
}
diff --git a/src/mode.cpp b/src/mode.cpp
index 018f3dde5..7747664ac 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -69,8 +69,8 @@ using namespace std;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
+
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
extern time_t TIME;
@@ -467,7 +467,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
{
if (type == MODETYPE_CHANNEL)
{
- targetchannel->WriteChannelWithServ(Config->ServerName, "MODE %s %s%s", targetchannel->name, output_sequence.c_str(), parameter_list.str().c_str());
+ targetchannel->WriteChannelWithServ(ServerInstance->Config->ServerName, "MODE %s %s%s", targetchannel->name, output_sequence.c_str(), parameter_list.str().c_str());
}
else
{
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index 8db699b19..47913bdc0 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -15,7 +15,7 @@
#include "modes/cmode_b.h"
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern int MODCOUNT;
@@ -105,7 +105,7 @@ std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *cha
}
else
{
- strlcpy(b.set_by,Config->ServerName,NICKMAX-1);
+ strlcpy(b.set_by,ServerInstance->Config->ServerName,NICKMAX-1);
}
chan->bans.push_back(b);
return dest;
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 7f32ad344..5137bfd4a 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -16,7 +16,7 @@
#include "modes/cmode_h.h"
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern int MODCOUNT;
@@ -48,7 +48,7 @@ ModeAction ModeChannelHalfOp::OnModeChange(userrec* source, userrec* dest, chanr
/* If halfops are not enabled in the conf, we don't execute
* anything in this class at all.
*/
- if (!Config->AllowHalfop)
+ if (!ServerInstance->Config->AllowHalfop)
{
parameter = "";
return MODEACTION_DENY;
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 22d95d5a9..e8c3cbed7 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -16,7 +16,7 @@
#include "modes/cmode_o.h"
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern int MODCOUNT;
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 69f64d2da..ddac844ec 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -16,7 +16,7 @@
#include "modes/cmode_v.h"
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
+extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern int MODCOUNT;
diff --git a/src/modules.cpp b/src/modules.cpp
index 3675319ec..428af2c6b 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -45,7 +45,6 @@
#include "command_parse.h"
#include "dns.h"
-extern ServerConfig *Config;
extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern ModuleList modules;
@@ -263,9 +262,9 @@ void Server::RemoveSocket(InspSocket* sock)
long Server::PriorityAfter(const std::string &modulename)
{
- for (unsigned int j = 0; j < Config->module_names.size(); j++)
+ for (unsigned int j = 0; j < ServerInstance->Config->module_names.size(); j++)
{
- if (Config->module_names[j] == modulename)
+ if (ServerInstance->Config->module_names[j] == modulename)
{
return ((j << 8) | PRIORITY_AFTER);
}
@@ -275,9 +274,9 @@ long Server::PriorityAfter(const std::string &modulename)
long Server::PriorityBefore(const std::string &modulename)
{
- for (unsigned int j = 0; j < Config->module_names.size(); j++)
+ for (unsigned int j = 0; j < ServerInstance->Config->module_names.size(); j++)
{
- if (Config->module_names[j] == modulename)
+ if (ServerInstance->Config->module_names[j] == modulename)
{
return ((j << 8) | PRIORITY_BEFORE);
}
@@ -323,7 +322,7 @@ const std::string& Server::GetModuleName(Module* m)
{
if (modules[i] == m)
{
- return Config->module_names[i];
+ return ServerInstance->Config->module_names[i];
}
}
return nothing; /* As above */
@@ -332,12 +331,12 @@ const std::string& Server::GetModuleName(Module* m)
void Server::RehashServer()
{
WriteOpers("*** Rehashing config file");
- Config->Read(false,NULL);
+ ServerInstance->Config->Read(false,NULL);
}
ServerConfig* Server::GetConfig()
{
- return Config;
+ return ServerInstance->Config;
}
std::string Server::GetVersion()
@@ -477,22 +476,22 @@ std::string Server::ChanMode(userrec* User, chanrec* Chan)
std::string Server::GetServerName()
{
- return Config->ServerName;
+ return ServerInstance->Config->ServerName;
}
std::string Server::GetNetworkName()
{
- return Config->Network;
+ return ServerInstance->Config->Network;
}
std::string Server::GetServerDescription()
{
- return Config->ServerDesc;
+ return ServerInstance->Config->ServerDesc;
}
Admin Server::GetAdmin()
{
- return Admin(Config->AdminName,Config->AdminEmail,Config->AdminNick);
+ return Admin(ServerInstance->Config->AdminName,ServerInstance->Config->AdminEmail,ServerInstance->Config->AdminNick);
}
@@ -679,7 +678,7 @@ Module* Server::FindModule(const std::string &name)
{
for (int i = 0; i <= MODCOUNT; i++)
{
- if (Config->module_names[i] == name)
+ if (ServerInstance->Config->module_names[i] == name)
{
return modules[i];
}
@@ -689,7 +688,7 @@ Module* Server::FindModule(const std::string &name)
ConfigReader::ConfigReader()
{
- // Config->ClearStack();
+ // ServerInstance->Config->ClearStack();
/* Is there any reason to load the entire config file again here?
* it's needed if they specify another config file, but using the
@@ -698,11 +697,11 @@ ConfigReader::ConfigReader()
//~ this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
this->errorlog = new std::ostringstream(std::stringstream::in | std::stringstream::out);
- //~ this->readerror = Config->LoadConf(CONFIG_FILE, this->cache,this->errorlog);
+ //~ this->readerror = ServerInstance->Config->LoadConf(CONFIG_FILE, this->cache,this->errorlog);
//~ if (!this->readerror)
//~ this->error = CONF_FILE_NOT_FOUND;
- this->data = &Config->config_data;
+ this->data = &ServerInstance->Config->config_data;
this->privatehash = false;
}
@@ -720,12 +719,12 @@ ConfigReader::~ConfigReader()
ConfigReader::ConfigReader(const std::string &filename)
{
- Config->ClearStack();
+ ServerInstance->Config->ClearStack();
this->data = new ConfigDataHash;
this->privatehash = true;
this->errorlog = new std::ostringstream(std::stringstream::in | std::stringstream::out);
- this->readerror = Config->LoadConf(*this->data, filename, *this->errorlog);
+ this->readerror = ServerInstance->Config->LoadConf(*this->data, filename, *this->errorlog);
if (!this->readerror)
this->error = CONF_FILE_NOT_FOUND;
};
@@ -735,7 +734,7 @@ std::string ConfigReader::ReadValue(const std::string &tag, const std::string &n
/* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */
std::string result;
- if (!Config->ConfValue(*this->data, tag, name, index, result))
+ if (!ServerInstance->Config->ConfValue(*this->data, tag, name, index, result))
{
this->error = CONF_VALUE_NOT_FOUND;
return "";
@@ -746,14 +745,14 @@ std::string ConfigReader::ReadValue(const std::string &tag, const std::string &n
bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int index)
{
- return Config->ConfValueBool(*this->data, tag, name, index);
+ return ServerInstance->Config->ConfValueBool(*this->data, tag, name, index);
}
long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, int index, bool needs_unsigned)
{
int result;
- if(!Config->ConfValueInteger(*this->data, tag, name, index, result))
+ if(!ServerInstance->Config->ConfValueInteger(*this->data, tag, name, index, result))
{
this->error = CONF_VALUE_NOT_FOUND;
return 0;
@@ -791,8 +790,8 @@ void ConfigReader::DumpErrors(bool bail, userrec* user)
unsigned int prefixlen;
start = 0;
- /* ":Config->ServerName NOTICE user->nick :" */
- prefixlen = strlen(Config->ServerName) + strlen(user->nick) + 11;
+ /* ":ServerInstance->Config->ServerName NOTICE user->nick :" */
+ prefixlen = strlen(ServerInstance->Config->ServerName) + strlen(user->nick) + 11;
if (user)
{
@@ -822,12 +821,12 @@ void ConfigReader::DumpErrors(bool bail, userrec* user)
int ConfigReader::Enumerate(const std::string &tag)
{
- return Config->ConfValueEnum(*this->data, tag);
+ return ServerInstance->Config->ConfValueEnum(*this->data, tag);
}
int ConfigReader::EnumerateValues(const std::string &tag, int index)
{
- return Config->ConfVarEnum(*this->data, tag, index);
+ return ServerInstance->Config->ConfVarEnum(*this->data, tag, index);
}
bool ConfigReader::Verify()
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index 26d231b14..da7559914 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -27,6 +27,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
class FilterPCREException : public ModuleException
{
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 7f2b96227..79baf170c 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -24,6 +24,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
#include "m_sqlv2.h"
/* VERSION 2 API: With nonblocking (threaded) requests */
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index a67ec46e2..89383ee47 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -30,7 +30,6 @@
/* Required for the FOREACH_MOD alias (OnOper event) */
extern int MODCOUNT;
-extern ServerConfig* Config;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index d9ee49bd0..30ece8f60 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -11,11 +11,14 @@
#include "helperfuncs.h"
#include "socket.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Provides SSL support for clients */
/* $CompileFlags: `libgnutls-config --cflags` */
/* $LinkerFlags: `libgnutls-config --libs` `perl ../gnutls_rpath.pl` */
+extern InspIRCd* ServerInstance;
+
enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED };
bool isin(int port, const std::vector<int> &portlist)
@@ -41,7 +44,6 @@ public:
class ModuleSSLGnuTLS : public Module
{
Server* Srv;
- ServerConfig* SrvConf;
ConfigReader* Conf;
char* dummy;
@@ -68,10 +70,9 @@ class ModuleSSLGnuTLS : public Module
: Module::Module(Me)
{
Srv = Me;
- SrvConf = Srv->GetConfig();
// Not rehashable...because I cba to reduce all the sizes of existing buffers.
- inbufsize = SrvConf->NetBufferSize;
+ inbufsize = ServerInstance->Config->NetBufferSize;
gnutls_global_init(); // This must be called once in the program
@@ -98,7 +99,7 @@ class ModuleSSLGnuTLS : public Module
for(unsigned int i = 0; i < listenports.size(); i++)
{
- SrvConf->DelIOHook(listenports[i]);
+ ServerInstance->Config->DelIOHook(listenports[i]);
}
listenports.clear();
@@ -110,7 +111,7 @@ class ModuleSSLGnuTLS : public Module
{
// Get the port we're meant to be listening on with SSL
unsigned int port = Conf->ReadInteger("bind", "port", i, true);
- if(SrvConf->AddIOHook(port, this))
+ if (ServerInstance->Config->AddIOHook(port, this))
{
// We keep a record of which ports we're listening on with SSL
listenports.push_back(port);
@@ -222,7 +223,7 @@ class ModuleSSLGnuTLS : public Module
log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers);
for(unsigned int i = 0; i < listenports.size(); i++)
- SrvConf->DelIOHook(listenports[i]);
+ ServerInstance->Config->DelIOHook(listenports[i]);
}
}
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index b2883c0f0..c0f02f322 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -12,11 +12,14 @@
#include "helperfuncs.h"
#include "socket.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Provides SSL support for clients */
/* $CompileFlags: -I/usr/include -I/usr/local/include */
/* $LinkerFlags: -L/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib -L/usr/lib -Wl,--rpath -Wl,/usr/lib -lssl */
+extern InspIRCd* ServerInstance;
+
enum issl_status { ISSL_NONE, ISSL_HANDSHAKING, ISSL_OPEN };
enum issl_io_status { ISSL_WRITE, ISSL_READ };
@@ -57,7 +60,6 @@ public:
class ModuleSSLOpenSSL : public Module
{
Server* Srv;
- ServerConfig* SrvConf;
ConfigReader* Conf;
CullList culllist;
@@ -83,10 +85,9 @@ class ModuleSSLOpenSSL : public Module
: Module::Module(Me)
{
Srv = Me;
- SrvConf = Srv->GetConfig();
// Not rehashable...because I cba to reduce all the sizes of existing buffers.
- inbufsize = SrvConf->NetBufferSize;
+ inbufsize = ServerInstance->Config->NetBufferSize;
/* Global SSL library initialization*/
SSL_library_init();
@@ -108,7 +109,7 @@ class ModuleSSLOpenSSL : public Module
for(unsigned int i = 0; i < listenports.size(); i++)
{
- SrvConf->DelIOHook(listenports[i]);
+ ServerInstance->Config->DelIOHook(listenports[i]);
}
listenports.clear();
@@ -120,7 +121,7 @@ class ModuleSSLOpenSSL : public Module
{
// Get the port we're meant to be listening on with SSL
unsigned int port = Conf->ReadInteger("bind", "port", i, true);
- if(SrvConf->AddIOHook(port, this))
+ if (ServerInstance->Config->AddIOHook(port, this))
{
// We keep a record of which ports we're listening on with SSL
listenports.push_back(port);
@@ -246,7 +247,7 @@ class ModuleSSLOpenSSL : public Module
log(DEBUG, "m_ssl_openssl.so: Killed %d users for unload of OpenSSL SSL module", numusers);
for(unsigned int i = 0; i < listenports.size(); i++)
- SrvConf->DelIOHook(listenports[i]);
+ ServerInstance->Config->DelIOHook(listenports[i]);
}
}
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 6ee50ea07..2ec6085fc 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -20,6 +20,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
#include <vector>
/* $ModDesc: Provides aliases of commands. */
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index ef8dc4d91..a530ea49b 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -6,6 +6,7 @@
#include "modules.h"
#include "mode.h"
#include "helperfuncs.h"
+#include "inspircd.h"
#include "u_listmode.h"
/* $ModDesc: Provides support for the +e channel mode */
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index 2d946fedb..97c255501 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -25,6 +25,7 @@
#include "modules.h"
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Attempt to block /amsg, at least some of the irritating mIRC scripts. */
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 93daeef61..0fea32288 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -19,6 +19,7 @@
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for channel mode +P to block all-CAPS channel messages and notices */
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 6c987611c..2b9006583 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +c */
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 3313b47f5..eb971864b 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -1,16 +1,16 @@
-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/* +------------------------------------+
+ * | Inspire Internet Relay Chat Daemon |
+ * +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- *<brain@chatspike.net>
- * <Craig@chatspike.net>
- * <omster@gmail.com>
+ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
+ * E-mail:
+ * <brain@chatspike.net>
+ * <Craig@chatspike.net>
+ * <omster@gmail.com>
*
* Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
- *the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
@@ -24,6 +24,7 @@
#include "modules.h"
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 69db8bbe6..5d18f9de8 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
typedef std::map<irc::string,irc::string> censor_t;
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 31a30de0e..a4f4d6068 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -25,6 +25,7 @@ using namespace std;
#include "helperfuncs.h"
#include "hashcomp.h"
#include "u_listmode.h"
+#include "inspircd.h"
/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 4ad3796b9..3764b400e 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -18,6 +18,7 @@
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides channel modes +a and +q */
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index ecda7cd0c..6021d7058 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -5,6 +5,7 @@
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Forces connecting clients to send a PONG message back to the server before they can complete their connection */
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 300d13b4a..254cfdcc1 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -19,6 +19,7 @@
#include "modules.h"
#include "hashcomp.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Implements config tags which allow blocking of joins to channels */
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index b4ba9f117..54a08ab98 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -26,7 +26,6 @@ using namespace std;
#include <stdio.h>
#include "users.h"
#include "channels.h"
-#include "helperfuncs.h"
#include "modules.h"
static Server *Srv;
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 1f7f6358a..9b4a12e39 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -26,6 +26,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: An enhanced version of the unreal m_filter.so used by chatspike.net */
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 5680a239b..69f61ab1a 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -20,6 +20,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
// Global Vars
static ConfigReader *helpop;
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 81f280cd3..0591ded9a 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "modules.h"
#include "inspsocket.h"
#include "helperfuncs.h"
+#include "inspircd.h"
#include "httpd.h"
/* $ModDesc: Provides HTTP serving facilities to modules */
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 1feeb9d24..544cc1475 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -32,7 +32,6 @@ extern user_hash clientlist;
extern chan_hash chanlist;
extern std::vector<userrec*> all_opers;
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
extern int MODCOUNT;
@@ -128,8 +127,8 @@ class ModuleHttpStats : public Module
data << "<table>";
for (int i = 0; i <= MODCOUNT; i++)
{
- if (Config->module_names[i] != "")
- data << "<tr><td>" << Config->module_names[i] << "</td></tr>";
+ if (ServerInstance->Config->module_names[i] != "")
+ data << "<tr><td>" << ServerInstance->Config->module_names[i] << "</td></tr>";
}
data << "</table>";
data << "</div>";
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index e739e3d92..3f3c44d98 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides channel mode +j (join flood protection) */
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 8779804c5..8f040cd38 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for /KNOCK and mode +K */
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index dbb7cecf1..53c9500db 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides channel mode +f (message flood protection) */
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index a49e9f622..d75ded180 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +c */
diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp
index 11a4e9493..2cf3954fe 100644
--- a/src/modules/m_noinvite.cpp
+++ b/src/modules/m_noinvite.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +V */
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 5d406ed85..c1cc9670f 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +Q */
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index b96990cdf..2cf62dd61 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -23,6 +23,7 @@ using namespace std;
#include "modules.h"
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index b11bd9d4e..a92b327d7 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +T */
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 16c988ce8..8d066b211 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for oper-only chans via the +O channel mode */
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index bf3088053..801e0ac10 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -6,6 +6,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Forces opers to join the specified channel(s) on oper-up */
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 6753daae9..cc248718f 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -5,6 +5,7 @@ using namespace std;
#include "modules.h"
#include <string>
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp
index e8fa613ff..d9519223d 100644
--- a/src/modules/m_opermd5.cpp
+++ b/src/modules/m_opermd5.cpp
@@ -27,6 +27,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* The four core functions - F1 is optimized somewhat */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index e38d0b827..6b964a8b2 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -7,6 +7,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Shows a message to opers after oper-up, adds /opermotd */
diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp
index 289ea6f7d..285d58d8b 100644
--- a/src/modules/m_opersha256.cpp
+++ b/src/modules/m_opersha256.cpp
@@ -45,6 +45,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
static Server *Srv;
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 116042ae6..9cb2e28ae 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -18,6 +18,7 @@
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style oper-override */
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp
index 7b7a0f1b3..e26af09f2 100644
--- a/src/modules/m_park.cpp
+++ b/src/modules/m_park.cpp
@@ -23,6 +23,7 @@ using namespace std;
#include "channels.h"
#include "helperfuncs.h"
#include "modules.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for user parking/unparking */
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 85e4e34b2..5f4fcc8f3 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -16,13 +16,11 @@
using namespace std;
-#include <stdio.h>
-#include <stdlib.h>
-#include <fstream>
#include "users.h"
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
static Server *Srv;
static FileReader *quotes = NULL;
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index c5a7f8e9c..208e55de2 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides channel mode +L (limit redirection) */
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index bb804676b..d5a5baba1 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Only opers may create new channels if this module is loaded */
diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp
index 50d87b353..75ffc46fd 100644
--- a/src/modules/m_restrictmsg.cpp
+++ b/src/modules/m_restrictmsg.cpp
@@ -23,6 +23,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Forbids users from messaging each other. Users may still message opers and opers may message other opers. */
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index 16455fe11..38985dcb5 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -22,7 +22,8 @@ using namespace std;
#include "helperfuncs.h"
#include "message.h"
#include <vector>
-
+#include "inspircd.h"
+
extern time_t TIME;
class ListData : public classbase
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index b32ba58ab..54f9ad066 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style SAJOIN command */
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 2e7cd9fe1..3e6c256a0 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -35,6 +35,7 @@ using namespace std;
#include "users.h"
#include "channels.h"
#include "modules.h"
+#include "inspircd.h"
static Server *Srv;
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 7a78a15ce..1299332fe 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -21,6 +21,7 @@ using namespace std;
#include "users.h"
#include "channels.h"
#include "modules.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for SANICK command */
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 6d1086bba..4493a178f 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style SAPART command */
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 7f622483c..3c9d95189 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -31,6 +31,7 @@ using namespace std;
#include "users.h"
#include "channels.h"
#include "modules.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index c1c79f8da..232a083be 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -22,7 +22,8 @@ using namespace std;
#include "helperfuncs.h"
#include "message.h"
#include <vector>
-
+#include "inspircd.h"
+
extern time_t TIME;
/* $ModDesc: A module overriding /list, and making it safe - stop those sendq problems. */
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index 9f5e1bdb7..2a7656f2f 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -23,6 +23,7 @@ using namespace std;
#include <string>
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
static bool kludgeme = false;
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 5ffb48f98..c545e26b6 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -23,6 +23,7 @@ using namespace std;
#include <string>
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Povides support for ircu-style services accounts, including chmode +R, etc. */
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index 9b51e6204..1343e665f 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -7,6 +7,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 855aca0e3..923c24981 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -24,6 +24,7 @@ using namespace std;
#include "modules.h"
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for the /SILENCE command */
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index aeeaa2c52..7d011970e 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -68,7 +68,6 @@ using namespace std;
class ModuleSpanningTree;
static ModuleSpanningTree* TreeProtocolModule;
-extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
@@ -820,14 +819,13 @@ class TreeSocket : public InspSocket
std::string MyCapabilities()
{
- ServerConfig* Config = Srv->GetConfig();
std::vector<std::string> modlist;
std::string capabilities = "";
for (int i = 0; i <= MODCOUNT; i++)
{
if ((modules[i]->GetVersion().Flags & VF_STATIC) || (modules[i]->GetVersion().Flags & VF_COMMON))
- modlist.push_back(Config->module_names[i]);
+ modlist.push_back(ServerInstance->Config->module_names[i]);
}
sort(modlist.begin(),modlist.end());
for (unsigned int i = 0; i < modlist.size(); i++)
@@ -3822,7 +3820,7 @@ class ModuleSpanningTree : public Module
user->WriteServ("351 %s :%s",user->nick,Version.c_str());
if (found == TreeRoot)
{
- std::stringstream out(Config->data005);
+ std::stringstream out(ServerInstance->Config->data005);
std::string token = "";
std::string line5 = "";
int token_counter = 0;
@@ -3910,7 +3908,7 @@ class ModuleSpanningTree : public Module
results.push_back(Srv->GetServerName()+" 244 "+user->nick+" H * * "+LinkBlocks[i].Name.c_str());
}
results.push_back(Srv->GetServerName()+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
- WriteOpers("*** Notice: %s '%c' requested by %s (%s@%s)",(!strcmp(user->server,Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick,user->ident,user->host);
+ WriteOpers("*** Notice: %s '%c' requested by %s (%s@%s)",(!strcmp(user->server,ServerInstance->Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick,user->ident,user->host);
return 1;
}
return 0;
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index b835e2c66..faf4e431a 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -48,7 +48,6 @@ using namespace std;
static Server *Srv;
-extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
extern chan_hash chanlist;
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index 0d4b0e515..d2b26cbe0 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -2,6 +2,7 @@
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +z */
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index 3550d9301..98c5945a7 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -22,6 +22,7 @@ using namespace std;
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides channel +S mode (strip ansi colour) */
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 88856c1f0..cb400a0bf 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -18,6 +18,7 @@
#include "channels.h"
#include "modules.h"
#include "helperfuncs.h"
+#include "inspircd.h"
/* $ModDesc: Provides the SWHOIS command which allows setting of arbitary WHOIS lines */
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index b3ecfec06..fad2409dc 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -25,6 +25,7 @@ using namespace std;
#include "modules.h"
#include "helperfuncs.h"
#include "hashcomp.h"
+#include "inspircd.h"
static Server *Srv;
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index fdedc7d64..083d8023c 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -24,7 +24,6 @@
#include "helperfuncs.h"
#include "snomasks.h"
-extern ServerConfig* Config;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
diff --git a/src/socket.cpp b/src/socket.cpp
index 58e2c5bad..693685428 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -25,7 +25,6 @@
#include "message.h"
extern InspIRCd* ServerInstance;
-extern ServerConfig* Config;
extern time_t TIME;
/* Used when comparing CIDR masks for the modulus bits left over.
@@ -273,7 +272,7 @@ bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port
else
{
log(DEBUG,"Bound port %s:%d",*addr ? addr : "*",port);
- if (listen(sockfd, Config->MaxConn) == -1)
+ if (listen(sockfd, ServerInstance->Config->MaxConn) == -1)
{
log(DEFAULT,"ERROR in listen(): %s",strerror(errno));
return false;
@@ -312,6 +311,7 @@ int OpenTCPSocket()
bool HasPort(int port, char* addr)
{
+ ServerConfig* Config = ServerInstance->Config;
for (unsigned long count = 0; count < ServerInstance->stats->BoundPortCount; count++)
{
if ((port == Config->ports[count]) && (!strcasecmp(Config->addrs[count],addr)))
@@ -328,6 +328,7 @@ int BindPorts(bool bail)
insp_sockaddr client, server;
int clientportcount = 0;
int BoundPortCount = 0;
+ ServerConfig* Config = ServerInstance->Config;
if (!bail)
{
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index bf6a457a2..d262b5cab 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -63,7 +63,6 @@ extern std::vector<userrec*> local_users;
extern InspSocket* socket_ref[MAX_DESCRIPTORS];
extern InspIRCd* ServerInstance;
-extern ServerConfig *Config;
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
char data[65536];
@@ -79,14 +78,14 @@ void ProcessUser(userrec* cu)
log(DEBUG,"Processing user with fd %d",cu->fd);
- if (Config->GetIOHook(cu->GetPort()))
+ if (ServerInstance->Config->GetIOHook(cu->GetPort()))
{
int result2 = 0;
int MOD_RESULT = 0;
try
{
- MOD_RESULT = Config->GetIOHook(cu->GetPort())->OnRawSocketRead(cu->fd,data,65535,result2);
+ MOD_RESULT = ServerInstance->Config->GetIOHook(cu->GetPort())->OnRawSocketRead(cu->fd,data,65535,result2);
log(DEBUG,"Data result returned by module: %d",MOD_RESULT);
}
catch (ModuleException& modexcept)
@@ -170,14 +169,14 @@ void ProcessUser(userrec* cu)
{
WriteOpers("*** Excess flood from %s",current->GetIPString());
log(DEFAULT,"Excess flood from: %s",current->GetIPString());
- add_zline(120,Config->ServerName,"Flood from unregistered connection",current->GetIPString());
+ add_zline(120,ServerInstance->Config->ServerName,"Flood from unregistered connection",current->GetIPString());
apply_lines(APPLY_ZLINES);
}
return;
}
- if (current->recvq.length() > (unsigned)Config->NetBufferSize)
+ if (current->recvq.length() > (unsigned)ServerInstance->Config->NetBufferSize)
{
if (current->registered == REG_ALL)
{
@@ -187,7 +186,7 @@ void ProcessUser(userrec* cu)
{
WriteOpers("*** Excess flood from %s",current->GetIPString());
log(DEFAULT,"Excess flood from: %s",current->GetIPString());
- add_zline(120,Config->ServerName,"Flood from unregistered connection",current->GetIPString());
+ add_zline(120,ServerInstance->Config->ServerName,"Flood from unregistered connection",current->GetIPString());
apply_lines(APPLY_ZLINES);
}
@@ -221,7 +220,7 @@ void ProcessUser(userrec* cu)
}
else
{
- add_zline(120,Config->ServerName,"Flood from unregistered connection",current->GetIPString());
+ add_zline(120,ServerInstance->Config->ServerName,"Flood from unregistered connection",current->GetIPString());
apply_lines(APPLY_ZLINES);
}
@@ -366,7 +365,7 @@ void DoBackgroundUserStuff(time_t TIME)
curr->nping = TIME+curr->pingmax;
continue;
}
- curr->Write("PING :%s",Config->ServerName);
+ curr->Write("PING :%s",ServerInstance->Config->ServerName);
curr->lastping = 0;
curr->nping = TIME+curr->pingmax;
}
diff --git a/src/users.cpp b/src/users.cpp
index bb3ef18e9..176def818 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -33,16 +33,12 @@
#include "cull_list.h"
extern InspIRCd* ServerInstance;
-extern int WHOWAS_STALE;
-extern int WHOWAS_MAX;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern std::vector<InspSocket*> module_sockets;
extern int MODCOUNT;
-extern InspSocket* socket_ref[MAX_DESCRIPTORS];
extern time_t TIME;
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
-extern ServerConfig *Config;
extern user_hash clientlist;
extern Server* MyServer;
extern std::vector<userrec*> local_users;
@@ -266,7 +262,7 @@ userrec::userrec()
{
// the PROPER way to do it, AVOID bzero at *ALL* costs
*password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = 0;
- server = (char*)FindServerNamePtr(Config->ServerName);
+ server = (char*)FindServerNamePtr(ServerInstance->Config->ServerName);
reset_due = TIME;
lines_in = fd = lastping = signon = idle_lastmsg = nping = registered = 0;
timeout = flood = bytes_in = bytes_out = cmds_in = cmds_out = 0;
@@ -682,11 +678,11 @@ void userrec::QuitUser(userrec *user,const std::string &quitreason)
if (IS_LOCAL(user))
{
- if (Config->GetIOHook(user->GetPort()))
+ if (ServerInstance->Config->GetIOHook(user->GetPort()))
{
try
{
- Config->GetIOHook(user->GetPort())->OnRawSocketClose(user->fd);
+ ServerInstance->Config->GetIOHook(user->GetPort())->OnRawSocketClose(user->fd);
}
catch (ModuleException& modexcept)
{
@@ -833,12 +829,12 @@ void userrec::AddClient(int socket, int port, bool iscached, insp_inaddr ip)
_new->fd = socket;
strlcpy(_new->nick,tempnick.c_str(),NICKMAX-1);
- _new->server = FindServerNamePtr(Config->ServerName);
+ _new->server = FindServerNamePtr(ServerInstance->Config->ServerName);
/* We don't need range checking here, we KNOW 'unknown\0' will fit into the ident field. */
strcpy(_new->ident, "unknown");
_new->registered = REG_NONE;
- _new->signon = TIME + Config->dns_timeout;
+ _new->signon = TIME + ServerInstance->Config->dns_timeout;
_new->lastping = 1;
log(DEBUG,"Setting socket addresses");
@@ -857,7 +853,7 @@ void userrec::AddClient(int socket, int port, bool iscached, insp_inaddr ip)
long class_sqmax = 262144; // 256kb
long class_rqmax = 4096; // 4k
- for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
+ for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
{
if ((i->type == CC_ALLOW) && (match(ipaddr,i->host.c_str(),true)))
{
@@ -871,7 +867,7 @@ void userrec::AddClient(int socket, int port, bool iscached, insp_inaddr ip)
}
}
- _new->nping = TIME + _new->pingmax + Config->dns_timeout;
+ _new->nping = TIME + _new->pingmax + ServerInstance->Config->dns_timeout;
_new->timeout = TIME+class_regtimeout;
_new->flood = class_flood;
_new->threshold = class_threshold;
@@ -881,7 +877,7 @@ void userrec::AddClient(int socket, int port, bool iscached, insp_inaddr ip)
fd_ref_table[socket] = _new;
local_users.push_back(_new);
- if (local_users.size() > Config->SoftLimit)
+ if (local_users.size() > ServerInstance->Config->SoftLimit)
{
userrec::QuitUser(_new,"No more connections allowed");
return;
@@ -1031,15 +1027,15 @@ void userrec::FullConnect(CullList* Goners)
}
- this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",Config->Network);
- this->WriteServ("001 %s :Welcome to the %s IRC Network %s!%s@%s",this->nick, Config->Network, this->nick, this->ident, this->host);
- this->WriteServ("002 %s :Your host is %s, running version %s",this->nick,Config->ServerName,VERSION);
+ this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network);
+ this->WriteServ("001 %s :Welcome to the %s IRC Network %s!%s@%s",this->nick, ServerInstance->Config->Network, this->nick, this->ident, this->host);
+ this->WriteServ("002 %s :Your host is %s, running version %s",this->nick,ServerInstance->Config->ServerName,VERSION);
this->WriteServ("003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__);
- this->WriteServ("004 %s %s %s %s %s %s", this->nick, Config->ServerName, VERSION, ServerInstance->ModeGrok->UserModeList().c_str(), ServerInstance->ModeGrok->ChannelModeList().c_str(), ServerInstance->ModeGrok->ParaModeList().c_str());
+ this->WriteServ("004 %s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->ModeGrok->UserModeList().c_str(), ServerInstance->ModeGrok->ChannelModeList().c_str(), ServerInstance->ModeGrok->ParaModeList().c_str());
// anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
// so i'd better split it :)
- std::stringstream out(Config->data005);
+ std::stringstream out(ServerInstance->Config->data005);
std::string token = "";
std::string line5 = "";
int token_counter = 0;
@@ -1287,11 +1283,11 @@ void userrec::Write(const std::string &text)
std::string crlf = text;
crlf.append("\r\n");
- if (Config->GetIOHook(this->GetPort()))
+ if (ServerInstance->Config->GetIOHook(this->GetPort()))
{
try
{
- Config->GetIOHook(this->GetPort())->OnRawSocketWrite(this->fd, crlf.data(), crlf.length());
+ ServerInstance->Config->GetIOHook(this->GetPort())->OnRawSocketWrite(this->fd, crlf.data(), crlf.length());
}
catch (ModuleException& modexcept)
{
@@ -1323,7 +1319,7 @@ void userrec::WriteServ(const std::string& text)
{
char textbuffer[MAXBUF];
- snprintf(textbuffer,MAXBUF,":%s %s",Config->ServerName,text.c_str());
+ snprintf(textbuffer,MAXBUF,":%s %s",ServerInstance->Config->ServerName,text.c_str());
this->Write(std::string(textbuffer));
}
@@ -1475,7 +1471,7 @@ void userrec::WriteCommonExcept(const std::string &text)
* opers and the other line to non-opers, then all this hidebans and hidesplits gunk
* can go byebye.
*/
- if (Config->HideSplits)
+ if (ServerInstance->Config->HideSplits)
{
char* check = textbuffer + 6;
@@ -1497,7 +1493,7 @@ void userrec::WriteCommonExcept(const std::string &text)
}
}
- if ((Config->HideBans) && (!quit_munge))
+ if ((ServerInstance->Config->HideBans) && (!quit_munge))
{
if ((!strncasecmp(textbuffer, "QUIT :G-Lined:",14)) || (!strncasecmp(textbuffer, "QUIT :K-Lined:",14))
|| (!strncasecmp(textbuffer, "QUIT :Q-Lined:",14)) || (!strncasecmp(textbuffer, "QUIT :Z-Lined:",14)))
diff --git a/src/xline.cpp b/src/xline.cpp
index 830f6d7c6..ae66b939d 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -39,12 +39,11 @@ using namespace std;
#include "configreader.h"
#include "cull_list.h"
-extern ServerConfig *Config;
+extern InspIRCd* ServerInstance;
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
-extern ServerConfig* Config;
extern user_hash clientlist;
extern std::vector<userrec*> local_users;
@@ -717,7 +716,7 @@ void apply_lines(const int What)
void stats_k(userrec* user, string_list &results)
{
- std::string sn = Config->ServerName;
+ std::string sn = ServerInstance->Config->ServerName;
for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++)
results.push_back(sn+" 216 "+user->nick+" :"+i->hostmask+" "+ConvToStr(i->set_time)+" "+ConvToStr(i->duration)+" "+i->source+" :"+i->reason);
for (std::vector<KLine>::iterator i = pklines.begin(); i != pklines.end(); i++)
@@ -726,7 +725,7 @@ void stats_k(userrec* user, string_list &results)
void stats_g(userrec* user, string_list &results)
{
- std::string sn = Config->ServerName;
+ std::string sn = ServerInstance->Config->ServerName;
for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
results.push_back(sn+" 223 "+user->nick+" :"+i->hostmask+" "+ConvToStr(i->set_time)+" "+ConvToStr(i->duration)+" "+i->source+" :"+i->reason);
for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++)
@@ -735,7 +734,7 @@ void stats_g(userrec* user, string_list &results)
void stats_q(userrec* user, string_list &results)
{
- std::string sn = Config->ServerName;
+ std::string sn = ServerInstance->Config->ServerName;
for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
results.push_back(sn+" 217 "+user->nick+" :"+i->nick+" "+ConvToStr(i->set_time)+" "+ConvToStr(i->duration)+" "+i->source+" :"+i->reason);
for (std::vector<QLine>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
@@ -744,7 +743,7 @@ void stats_q(userrec* user, string_list &results)
void stats_z(userrec* user, string_list &results)
{
- std::string sn = Config->ServerName;
+ std::string sn = ServerInstance->Config->ServerName;
for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
results.push_back(sn+" 223 "+user->nick+" :"+i->ipaddr+" "+ConvToStr(i->set_time)+" "+ConvToStr(i->duration)+" "+i->source+" :"+i->reason);
for (std::vector<ZLine>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
@@ -753,7 +752,7 @@ void stats_z(userrec* user, string_list &results)
void stats_e(userrec* user, string_list &results)
{
- std::string sn = Config->ServerName;
+ std::string sn = ServerInstance->Config->ServerName;
for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
results.push_back(sn+" 223 "+user->nick+" :"+i->hostmask+" "+ConvToStr(i->set_time)+" "+ConvToStr(i->duration)+" "+i->source+" :"+i->reason);
for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++)