From d02a5866d4fdedec9219aeca0a6048828b394fd2 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 10 Aug 2006 21:19:19 +0000 Subject: Mass-tidyup of module global vars, theyre no longer global vars. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4856 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sqloper.cpp | 4 ---- src/modules/m_conn_lusers.cpp | 5 ++++- src/modules/m_httpd_stats.cpp | 4 +--- src/modules/m_remove.cpp | 2 +- src/modules/m_safelist.cpp | 5 +++-- src/modules/m_spanningtree.cpp | 8 ++------ 6 files changed, 11 insertions(+), 17 deletions(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 7e905d691..cd4ef7102 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -28,10 +28,6 @@ /* $ModDesc: Allows storage of oper credentials in an SQL table */ -/* Required for the FOREACH_MOD alias (OnOper event) */ -extern int MODCOUNT; -extern std::vector modules; -extern std::vector factory; extern InspIRCd* ServerInstance; class ModuleSQLOper : public Module diff --git a/src/modules/m_conn_lusers.cpp b/src/modules/m_conn_lusers.cpp index 2d9823015..f988c76c0 100644 --- a/src/modules/m_conn_lusers.cpp +++ b/src/modules/m_conn_lusers.cpp @@ -19,9 +19,12 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" +#include "inspircd.h" /* $ModDesc: Sends the /LUSERS on connect */ +extern InspIRCd* ServerInstance; + // This has to be the simplest module ever. // The RFC doesnt specify that you should send the /LUSERS numerics // on connect, but someone asked for it, so its in a module. @@ -60,7 +63,7 @@ class ModuleConnLUSERS : public Module // protocol module. Yes, at some point there will // be a way to get the current protocol module's name // from the core and probably a pointer to its class. - Module* Proto = Srv->FindModule("m_spanningtree.so"); + Module* Proto = ServerInstance->FindModule("m_spanningtree.so"); if (Proto) { Proto->OnPreCommand("LUSERS", NULL, 0, user, true); diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index e68a3756f..27548c91c 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -31,8 +31,6 @@ using namespace std; extern std::vector all_opers; extern InspIRCd* ServerInstance; -extern int MODCOUNT; - typedef std::map StatsHash; typedef StatsHash::iterator StatsIter; @@ -123,7 +121,7 @@ class ModuleHttpStats : public Module data << "
"; data << "

Modules

"; data << ""; - for (int i = 0; i <= MODCOUNT; i++) + for (int i = 0; i <= ServerInstance->GetModuleCount(); i++) { if (ServerInstance->Config->module_names[i] != "") data << ""; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index e681d39b6..5fa614312 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -154,7 +154,7 @@ class RemoveBase tlevel = chartolevel(channel->GetStatusChar(target)); } - hasnokicks = (Srv->FindModule("m_nokicks.so") && channel->IsModeSet('Q')); + hasnokicks = (ServerInstance->FindModule("m_nokicks.so") && channel->IsModeSet('Q')); /* We support the +Q channel mode via. the m_nokicks module, if the module is loaded and the mode is set then disallow the /remove */ if(!supportnokicks || !hasnokicks || (ulevel == ULINE)) diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 2ffb851b9..543966112 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -75,13 +75,14 @@ class ListTimer : public InspTimer /* * What we do here: * - Get where they are up to - * - If it's > GetChannelCount, erase them from the iterator, set go_again to true + * - If it's more than total number of channels, erase + * them from the iterator, set go_again to true * - If not, spool more channels */ userrec* u = (userrec*)(*iter); ListData* ld; u->GetExt("safelist_cache", ld); - if (ld->list_position > Srv->GetChannelCount()) + if ((size_t)ld->list_position > ServerInstance->chanlist.size()) { u->Shrink("safelist_cache"); DELETE(ld); diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index cd13e5bfd..d9e18ef80 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -71,10 +71,6 @@ static ModuleSpanningTree* TreeProtocolModule; extern InspIRCd* ServerInstance; -extern std::vector modules; -extern std::vector factory; -extern int MODCOUNT; - /* Any socket can have one of five states at any one time. * The LISTENER state indicates a socket which is listening * for connections. It cannot receive data itself, only incoming @@ -820,9 +816,9 @@ class TreeSocket : public InspSocket std::vector modlist; std::string capabilities = ""; - for (int i = 0; i <= MODCOUNT; i++) + for (int i = 0; i <= ServerInstance->GetModuleCount(); i++) { - if ((modules[i]->GetVersion().Flags & VF_STATIC) || (modules[i]->GetVersion().Flags & VF_COMMON)) + if ((ServerInstance->modules[i]->GetVersion().Flags & VF_STATIC) || (ServerInstance->modules[i]->GetVersion().Flags & VF_COMMON)) modlist.push_back(ServerInstance->Config->module_names[i]); } sort(modlist.begin(),modlist.end()); -- cgit v1.2.3
" << ServerInstance->Config->module_names[i] << "