summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-28 23:32:41 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-28 23:32:41 +0000
commit8394be69a0e3b5fea617c69b69aa27daf547fc4e (patch)
treeccf40646d8ed2145d9c6a3693e073434fe33bc4c /src
parentaa953912596e5fae066804ac6afbe9c44ceae50d (diff)
Move everything module-related out of InspIRCd and into ModuleManager, there is a ModuleManager instantiated as InspIRCd::Modules. Several of the function names have changed slightly as well. e.g. Instance->FindModule(m_foobar.so); is now Instance->Modules->Find(m_foobar.so);
All modules in the core distribution should also be updated in line with these changes. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7985 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_loadmodule.cpp5
-rw-r--r--src/cmd_modules.cpp4
-rw-r--r--src/cmd_reloadmodule.cpp4
-rw-r--r--src/cmd_stats.cpp4
-rw-r--r--src/cmd_unloadmodule.cpp4
-rw-r--r--src/configreader.cpp9
-rw-r--r--src/helperfuncs.cpp24
-rw-r--r--src/inspircd.cpp29
-rw-r--r--src/modules.cpp281
-rw-r--r--src/modules/extra/m_mysql.cpp15
-rw-r--r--src/modules/extra/m_pgsql.cpp13
-rw-r--r--src/modules/extra/m_sqlauth.cpp13
-rw-r--r--src/modules/extra/m_sqllog.cpp13
-rw-r--r--src/modules/extra/m_sqloper.cpp19
-rw-r--r--src/modules/extra/m_sqlutils.cpp5
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp3
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp3
-rw-r--r--src/modules/extra/m_testclient.cpp3
-rw-r--r--src/modules/m_auditorium.cpp2
-rw-r--r--src/modules/m_banexception.cpp4
-rw-r--r--src/modules/m_banredirect.cpp6
-rw-r--r--src/modules/m_cloaking.cpp6
-rw-r--r--src/modules/m_globalload.cpp16
-rw-r--r--src/modules/m_hostchange.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp4
-rw-r--r--src/modules/m_invisible.cpp2
-rw-r--r--src/modules/m_inviteexception.cpp4
-rw-r--r--src/modules/m_md5.cpp4
-rw-r--r--src/modules/m_oper_hash.cpp6
-rw-r--r--src/modules/m_remove.cpp2
-rw-r--r--src/modules/m_rpc_json.cpp4
-rw-r--r--src/modules/m_securelist.cpp2
-rw-r--r--src/modules/m_sha256.cpp5
-rw-r--r--src/modules/m_spanningtree/main.cpp5
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp11
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp6
-rw-r--r--src/modules/m_spanningtree/utils.cpp3
-rw-r--r--src/modules/m_uhnames.cpp3
38 files changed, 278 insertions, 270 deletions
diff --git a/src/cmd_loadmodule.cpp b/src/cmd_loadmodule.cpp
index c23dace62..e9f6cf39c 100644
--- a/src/cmd_loadmodule.cpp
+++ b/src/cmd_loadmodule.cpp
@@ -23,7 +23,7 @@ extern "C" DllExport command_t* init_command(InspIRCd* Instance)
*/
CmdResult cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
- if (ServerInstance->LoadModule(parameters[0]))
+ if (ServerInstance->Modules->Load(parameters[0]))
{
ServerInstance->WriteOpers("*** NEW MODULE: %s loaded %s",user->nick, parameters[0]);
user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
@@ -31,8 +31,7 @@ CmdResult cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *us
}
else
{
- user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0], ServerInstance->Modules->LastError());
return CMD_FAILURE;
}
}
-
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index aa31122a7..dc3eea15d 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -42,7 +42,7 @@ CmdResult cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
{
for (unsigned int i = 0; i < ServerInstance->Config->module_names.size(); i++)
{
- Version V = ServerInstance->modules[i]->GetVersion();
+ Version V = ServerInstance->Modules->modules[i]->GetVersion();
char modulename[MAXBUF];
char flagstate[MAXBUF];
*flagstate = 0;
@@ -59,7 +59,7 @@ CmdResult cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
strlcpy(modulename,ServerInstance->Config->module_names[i].c_str(),256);
if (IS_OPER(user))
{
- user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,ServerInstance->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
+ user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,ServerInstance->Modules->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
}
else
{
diff --git a/src/cmd_reloadmodule.cpp b/src/cmd_reloadmodule.cpp
index d05d36f3b..df198d662 100644
--- a/src/cmd_reloadmodule.cpp
+++ b/src/cmd_reloadmodule.cpp
@@ -21,10 +21,10 @@ extern "C" DllExport command_t* init_command(InspIRCd* Instance)
CmdResult cmd_reloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
- if (ServerInstance->UnloadModule(parameters[0]))
+ if (ServerInstance->Modules->Unload(parameters[0]))
{
ServerInstance->WriteOpers("*** RELOAD MODULE: %s unloaded %s",user->nick, parameters[0]);
- if (ServerInstance->LoadModule(parameters[0]))
+ if (ServerInstance->Modules->Load(parameters[0]))
{
ServerInstance->WriteOpers("*** RELOAD MODULE: %s reloaded %s",user->nick, parameters[0]);
user->WriteServ("975 %s %s :Module successfully reloaded.",user->nick, parameters[0]);
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index 58fcbb977..2e74d7d06 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -196,8 +196,8 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user,
}
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(ServerInstance->modules.size())+" ("+ConvToStr(ServerInstance->modules.size()*sizeof(Module))+" bytes)");
- results.push_back(sn+" 249 "+user->nick+" :ClassFactories(VECTOR) "+ConvToStr(ServerInstance->factory.size())+" ("+ConvToStr(ServerInstance->factory.size()*sizeof(ircd_module))+" bytes)");
+ results.push_back(sn+" 249 "+user->nick+" :Modules(VECTOR) "+ConvToStr(ServerInstance->Modules->modules.size())+" ("+ConvToStr(ServerInstance->Modules->modules.size()*sizeof(Module))+" bytes)");
+ results.push_back(sn+" 249 "+user->nick+" :ModuleHandles(VECTOR) "+ConvToStr(ServerInstance->Modules->handles.size())+" ("+ConvToStr(ServerInstance->Modules->handles.size()*sizeof(ircd_module))+" bytes)");
#ifndef WIN32
/* Moved this down here so all the not-windows stuff (look w00tie, I didn't say win32!) is in one ifndef.
diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp
index 137525d32..932142049 100644
--- a/src/cmd_unloadmodule.cpp
+++ b/src/cmd_unloadmodule.cpp
@@ -23,14 +23,14 @@ extern "C" DllExport command_t* init_command(InspIRCd* Instance)
CmdResult cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
- if (ServerInstance->UnloadModule(parameters[0]))
+ if (ServerInstance->Modules->Unload(parameters[0]))
{
ServerInstance->WriteOpers("*** MODULE UNLOADED: %s unloaded %s", user->nick, parameters[0]);
user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
}
else
{
- user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->Modules->LastError());
return CMD_FAILURE;
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 3b3396f5c..3767fbda9 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -936,7 +936,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{
for (std::vector<std::string>::iterator removing = removed_modules.begin(); removing != removed_modules.end(); removing++)
{
- if (ServerInstance->UnloadModule(removing->c_str()))
+ if (ServerInstance->Modules->Unload(removing->c_str()))
{
ServerInstance->WriteOpers("*** REHASH UNLOADED MODULE: %s",removing->c_str());
@@ -948,7 +948,7 @@ void ServerConfig::Read(bool bail, userrec* user)
else
{
if (user)
- user->WriteServ("972 %s %s :Failed to unload module %s: %s",user->nick, removing->c_str(), removing->c_str(), ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module %s: %s",user->nick, removing->c_str(), removing->c_str(), ServerInstance->Modules->LastError());
}
}
}
@@ -957,7 +957,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{
for (std::vector<std::string>::iterator adding = added_modules.begin(); adding != added_modules.end(); adding++)
{
- if (ServerInstance->LoadModule(adding->c_str()))
+ if (ServerInstance->Modules->Load(adding->c_str()))
{
ServerInstance->WriteOpers("*** REHASH LOADED MODULE: %s",adding->c_str());
@@ -969,7 +969,7 @@ void ServerConfig::Read(bool bail, userrec* user)
else
{
if (user)
- user->WriteServ("974 %s %s :Failed to load module %s: %s",user->nick, adding->c_str(), adding->c_str(), ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module %s: %s",user->nick, adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError());
}
}
}
@@ -1777,4 +1777,3 @@ bool ValueItem::GetBool()
{
return (GetInteger() || v == "yes" || v == "true");
}
-
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 608ed2f1b..1defef047 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -527,29 +527,6 @@ void InspIRCd::CheckDie()
}
}
-/* We must load the modules AFTER initializing the socket engine, now */
-void InspIRCd::LoadAllModules()
-{
- char configToken[MAXBUF];
- Config->module_names.clear();
- this->ModCount = -1;
-
- for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "module"); count++)
- {
- Config->ConfValue(Config->config_data, "module", "name", count, configToken, MAXBUF);
- printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken);
-
- if (!this->LoadModule(configToken))
- {
- this->Log(DEFAULT,"There was an error loading the module '%s': %s", configToken, this->ModuleError());
- printf_c("\n[\033[1;31m*\033[0m] There was an error loading the module '%s': %s\n\n", configToken, this->ModuleError());
- Exit(EXIT_STATUS_MODULE);
- }
- }
- printf_c("\nA total of \033[1;32m%d\033[0m module%s been loaded.\n", this->ModCount+1, this->ModCount+1 == 1 ? " has" : "s have");
- this->Log(DEFAULT,"Total loaded modules: %d", this->ModCount+1);
-}
-
void InspIRCd::SendWhoisLine(userrec* user, userrec* dest, int numeric, const std::string &text)
{
std::string copy_text = text;
@@ -571,4 +548,3 @@ void InspIRCd::SendWhoisLine(userrec* user, userrec* dest, int numeric, const ch
this->SendWhoisLine(user, dest, numeric, std::string(textbuffer));
}
-
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 962f84501..fe36208d1 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -68,7 +68,7 @@ const char* ExitCodes[] =
void InspIRCd::Cleanup()
{
std::vector<std::string> mymodnames;
- int MyModCount = this->GetModuleCount();
+ int MyModCount = this->Modules->GetCount();
if (Config)
{
@@ -94,7 +94,7 @@ void InspIRCd::Cleanup()
*/
for (int tries = 0; tries < 3; tries++)
{
- MyModCount = this->GetModuleCount();
+ MyModCount = this->Modules->GetCount();
mymodnames.clear();
if (MyModCount)
@@ -104,7 +104,7 @@ void InspIRCd::Cleanup()
mymodnames.push_back(Config->module_names[j]);
for (int k = 0; k <= MyModCount; k++)
- this->UnloadModule(mymodnames[k].c_str());
+ this->Modules->Unload(mymodnames[k].c_str());
}
}
@@ -280,8 +280,7 @@ void InspIRCd::WritePID(const std::string &filename)
}
InspIRCd::InspIRCd(int argc, char** argv)
- : ModCount(0),
- GlobalCulls(this),
+ : GlobalCulls(this),
/* Functor initialisation. Note that the ordering here is very important. */
HandleProcessUser(this),
@@ -304,8 +303,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
int do_version = 0, do_nofork = 0, do_debug = 0, do_nolog = 0, do_root = 0; /* flag variables */
char c = 0;
- modules.resize(255);
- factory.resize(255);
memset(&server, 0, sizeof(server));
memset(&client, 0, sizeof(client));
@@ -425,12 +422,17 @@ InspIRCd::InspIRCd(int argc, char** argv)
Exit(EXIT_STATUS_LOG);
}
+ this->Modules = new ModuleManager(this);
this->stats = new serverstats();
this->Timers = new TimerManager(this);
this->Parser = new CommandParser(this);
this->XLines = new XLineManager(this);
+
Config->ClearStack();
Config->Read(true, NULL);
+
+ this->Modules->modules.resize(255);
+ this->Modules->handles.resize(255);
/*
* Initialise UID. XXX, we need to read SID from config, and use it instead of 000.
@@ -510,7 +512,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
this->Res = new DNS(this);
- this->LoadAllModules();
+ this->Modules->LoadAll();
+
/* Just in case no modules were loaded - fix for bug #101 */
this->BuildISupport();
InitializeDisabledCommands(Config->DisabledCommands, this);
@@ -702,11 +705,11 @@ bool InspIRCd::AllModulesReportReady(userrec* user)
if (!Config->global_implementation[I_OnCheckReady])
return true;
- for (int i = 0; i <= this->GetModuleCount(); i++)
+ for (int i = 0; i <= this->Modules->GetCount(); i++)
{
if (Config->implement_lists[i][I_OnCheckReady])
{
- int res = modules[i]->OnCheckReady(user);
+ int res = this->Modules->modules[i]->OnCheckReady(user);
if (!res)
return false;
}
@@ -714,11 +717,6 @@ bool InspIRCd::AllModulesReportReady(userrec* user)
return true;
}
-int InspIRCd::GetModuleCount()
-{
- return this->ModCount;
-}
-
time_t InspIRCd::Time(bool delta)
{
if (delta)
@@ -761,4 +759,3 @@ void InspIRCd::SetSignal(int signal)
{
*mysig = signal;
}
-
diff --git a/src/modules.cpp b/src/modules.cpp
index 7c01fcab6..cf2724b7a 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -18,7 +18,7 @@
#include "socketengine.h"
#include "command_parse.h"
#include "dns.h"
-
+#include "exitcodes.h"
#ifndef WIN32
#include <dirent.h>
@@ -196,60 +196,88 @@ void Module::OnGarbageCollect() { }
void Module::OnBufferFlushed(userrec* user) { }
-char* InspIRCd::ModuleError()
+ModuleManager::ModuleManager(InspIRCd* Ins)
+: ModCount(0), Instance(Ins)
+{
+}
+
+ModuleManager::~ModuleManager()
+{
+}
+
+const char* ModuleManager::LastError()
{
return MODERR;
}
-void InspIRCd::EraseFactory(int j)
+bool ModuleManager::EraseHandle(unsigned int j)
{
- int v = 0;
- for (std::vector<ircd_module*>::iterator t = factory.begin(); t != factory.end(); t++)
+ ModuleHandleList::iterator iter;
+
+ if((j < 0) || (j >= handles.size()))
{
- if (v == j)
- {
- delete *t;
- factory.erase(t);
- factory.push_back(NULL);
- return;
- }
- v++;
+ return false;
}
+
+ iter = handles.begin() + j;
+
+ if(*iter)
+ {
+ delete *iter;
+ handles.erase(iter);
+ handles.push_back(NULL);
+ }
+
+ return true;
}
-void InspIRCd::EraseModule(int j)
+bool ModuleManager::EraseModule(unsigned int j)
{
- int v1 = 0;
- for (ModuleList::iterator m = modules.begin(); m!= modules.end(); m++)
+ bool success = false;
+
{
- if (v1 == j)
+ ModuleList::iterator iter;
+
+ if((j < 0) || (j >= modules.size()))
{
- delete *m;
- modules.erase(m);
- modules.push_back(NULL);
- break;
+ return false;
+ }
+
+ iter = modules.begin() + j;
+
+ if(*iter)
+ {
+ delete *iter;
+ modules.erase(iter);
+ modules.push_back(NULL);
+ success = true;
}
- v1++;
}
- int v2 = 0;
- for (std::vector<std::string>::iterator v = Config->module_names.begin(); v != Config->module_names.end(); v++)
+
{
- if (v2 == j)
+ std::vector<std::string>::iterator iter;
+
+ if((j < 0) || (j >= Instance->Config->module_names.size()))
{
- Config->module_names.erase(v);
- break;
+ return false;
}
- v2++;
+
+ iter = Instance->Config->module_names.begin() + j;
+
+ Instance->Config->module_names.erase(iter);
+ success = true;
}
+ return success;
}
-void InspIRCd::MoveTo(std::string modulename,int slot)
+void ModuleManager::MoveTo(std::string modulename,int slot)
{
unsigned int v2 = 256;
- for (unsigned int v = 0; v < Config->module_names.size(); v++)
+
+ for (unsigned int v = 0; v < Instance->Config->module_names.size(); v++)
{
- if (Config->module_names[v] == modulename)
+ if (Instance->Config->module_names[v] == modulename)
{
// found an instance, swap it with the item at the end
v2 = v;
@@ -259,12 +287,12 @@ void InspIRCd::MoveTo(std::string modulename,int slot)
if ((v2 != (unsigned int)slot) && (v2 < 256))
{
// Swap the module names over
- Config->module_names[v2] = Config->module_names[slot];
- Config->module_names[slot] = modulename;
+ Instance->Config->module_names[v2] = Instance->Config->module_names[slot];
+ Instance->Config->module_names[slot] = modulename;
// now swap the module factories
- ircd_module* temp = factory[v2];
- factory[v2] = factory[slot];
- factory[slot] = temp;
+ ircd_module* temp = handles[v2];
+ handles[v2] = handles[slot];
+ handles[slot] = temp;
// now swap the module objects
Module* temp_module = modules[v2];
modules[v2] = modules[slot];
@@ -273,18 +301,18 @@ void InspIRCd::MoveTo(std::string modulename,int slot)
// need to swap the global or recount it)
for (int n = 0; n < 255; n++)
{
- char x = Config->implement_lists[v2][n];
- Config->implement_lists[v2][n] = Config->implement_lists[slot][n];
- Config->implement_lists[slot][n] = x;
+ char x = Instance->Config->implement_lists[v2][n];
+ Instance->Config->implement_lists[v2][n] = Instance->Config->implement_lists[slot][n];
+ Instance->Config->implement_lists[slot][n] = x;
}
}
}
-void InspIRCd::MoveAfter(std::string modulename, std::string after)
+void ModuleManager::MoveAfter(std::string modulename, std::string after)
{
- for (unsigned int v = 0; v < Config->module_names.size(); v++)
+ for (unsigned int v = 0; v < Instance->Config->module_names.size(); v++)
{
- if (Config->module_names[v] == after)
+ if (Instance->Config->module_names[v] == after)
{
MoveTo(modulename, v);
return;
@@ -292,11 +320,11 @@ void InspIRCd::MoveAfter(std::string modulename, std::string after)
}
}
-void InspIRCd::MoveBefore(std::string modulename, std::string before)
+void ModuleManager::MoveBefore(std::string modulename, std::string before)
{
- for (unsigned int v = 0; v < Config->module_names.size(); v++)
+ for (unsigned int v = 0; v < Instance->Config->module_names.size(); v++)
{
- if (Config->module_names[v] == before)
+ if (Instance->Config->module_names[v] == before)
{
if (v > 0)
{
@@ -311,33 +339,33 @@ void InspIRCd::MoveBefore(std::string modulename, std::string before)
}
}
-void InspIRCd::MoveToFirst(std::string modulename)
+void ModuleManager::MoveToFirst(std::string modulename)
{
MoveTo(modulename,0);
}
-void InspIRCd::MoveToLast(std::string modulename)
+void ModuleManager::MoveToLast(std::string modulename)
{
- MoveTo(modulename,this->GetModuleCount());
+ MoveTo(modulename,this->GetCount());
}
-bool InspIRCd::UnloadModule(const char* filename)
+bool ModuleManager::Unload(const char* filename)
{
std::string filename_str = filename;
- for (unsigned int j = 0; j != Config->module_names.size(); j++)
+ for (unsigned int j = 0; j != Instance->Config->module_names.size(); j++)
{
- if (Config->module_names[j] == filename_str)
+ if (Instance->Config->module_names[j] == filename_str)
{
if (modules[j]->GetVersion().Flags & VF_STATIC)
{
- this->Log(DEFAULT,"Failed to unload STATIC module %s",filename);
+ Instance->Log(DEFAULT,"Failed to unload STATIC module %s",filename);
snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)");
return false;
}
std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modules[j]);
if (intercount.first > 0)
{
- this->Log(DEFAULT,"Failed to unload module %s, being used by %d other(s) via interface '%s'",filename, intercount.first, intercount.second.c_str());
+ Instance->Log(DEFAULT,"Failed to unload module %s, being used by %d other(s) via interface '%s'",filename, intercount.first, intercount.second.c_str());
snprintf(MODERR,MAXBUF,"Module not unloadable (Still in use by %d other module%s which %s using its interface '%s') -- unload dependent modules first!",
intercount.first,
intercount.first > 1 ? "s" : "",
@@ -346,23 +374,23 @@ bool InspIRCd::UnloadModule(const char* filename)
return false;
}
/* Give the module a chance to tidy out all its metadata */
- for (chan_hash::iterator c = this->chanlist->begin(); c != this->chanlist->end(); c++)
+ for (chan_hash::iterator c = Instance->chanlist->begin(); c != Instance->chanlist->end(); c++)
{
modules[j]->OnCleanup(TYPE_CHANNEL,c->second);
}
- for (user_hash::iterator u = this->clientlist->begin(); u != this->clientlist->end(); u++)
+ for (user_hash::iterator u = Instance->clientlist->begin(); u != Instance->clientlist->end(); u++)
{
modules[j]->OnCleanup(TYPE_USER,u->second);
}
/* Tidy up any dangling resolvers */
- this->Res->CleanResolvers(modules[j]);
+ Instance->Res->CleanResolvers(modules[j]);
- FOREACH_MOD_I(this,I_OnUnloadModule,OnUnloadModule(modules[j],Config->module_names[j]));
+ FOREACH_MOD_I(Instance,I_OnUnloadModule,OnUnloadModule(modules[j],Instance->Config->module_names[j]));
for(int t = 0; t < 255; t++)
{
- Config->global_implementation[t] -= Config->implement_lists[j][t];
+ Instance->Config->global_implementation[t] -= Instance->Config->implement_lists[j][t];
}
/* We have to renumber implement_lists after unload because the module numbers change!
@@ -371,26 +399,49 @@ bool InspIRCd::UnloadModule(const char* filename)
{
for(int t = 0; t < 255; t++)
{
- Config->implement_lists[j2][t] = Config->implement_lists[j2+1][t];
+ Instance->Config->implement_lists[j2][t] = Instance->Config->implement_lists[j2+1][t];
}
}
// found the module
- Parser->RemoveCommands(filename);
+ Instance->Parser->RemoveCommands(filename);
this->EraseModule(j);
- this->EraseFactory(j);
- this->Log(DEFAULT,"Module %s unloaded",filename);
+ this->EraseHandle(j);
+ Instance->Log(DEFAULT,"Module %s unloaded",filename);
this->ModCount--;
- BuildISupport();
+ Instance->BuildISupport();
return true;
}
}
- this->Log(DEFAULT,"Module %s is not loaded, cannot unload it!",filename);
+ Instance->Log(DEFAULT,"Module %s is not loaded, cannot unload it!",filename);
snprintf(MODERR,MAXBUF,"Module not loaded");
return false;
}
-bool InspIRCd::LoadModule(const char* filename)
+/* We must load the modules AFTER initializing the socket engine, now */
+void ModuleManager::LoadAll()
+{
+ char configToken[MAXBUF];
+ Instance->Config->module_names.clear();
+ ModCount = -1;
+
+ for(int count = 0; count < Instance->Config->ConfValueEnum(Instance->Config->config_data, "module"); count++)
+ {
+ Instance->Config->ConfValue(Instance->Config->config_data, "module", "name", count, configToken, MAXBUF);
+ printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken);
+
+ if (!this->Load(configToken))
+ {
+ Instance->Log(DEFAULT,"There was an error loading the module '%s': %s", configToken, this->LastError());
+ printf_c("\n[\033[1;31m*\033[0m] There was an error loading the module '%s': %s\n\n", configToken, this->LastError());
+ Instance->Exit(EXIT_STATUS_MODULE);
+ }
+ }
+ printf_c("\nA total of \033[1;32m%d\033[0m module%s been loaded.\n", this->GetCount(), this->GetCount() == 1 ? " has" : "s have");
+ Instance->Log(DEFAULT,"Total loaded modules: %d", this->GetCount());
+}
+
+bool ModuleManager::Load(const char* filename)
{
/* Do we have a glob pattern in the filename?
* The user wants to load multiple modules which
@@ -399,16 +450,16 @@ bool InspIRCd::LoadModule(const char* filename)
if (strchr(filename,'*') || (strchr(filename,'?')))
{
int n_match = 0;
- DIR* library = opendir(Config->ModPath);
+ DIR* library = opendir(Instance->Config->ModPath);
if (library)
{
/* Try and locate and load all modules matching the pattern */
dirent* entry = NULL;
while ((entry = readdir(library)))
{
- if (this->MatchText(entry->d_name, filename))
+ if (Instance->MatchText(entry->d_name, filename))
{
- if (!this->LoadModule(entry->d_name))
+ if (!this->Load(entry->d_name))
n_match++;
}
}
@@ -422,23 +473,23 @@ bool InspIRCd::LoadModule(const char* filename)
}
char modfile[MAXBUF];
- snprintf(modfile,MAXBUF,"%s/%s",Config->ModPath,filename);
+ snprintf(modfile,MAXBUF,"%s/%s",Instance->Config->ModPath,filename);
std::string filename_str = filename;
if (!ServerConfig::DirValid(modfile))
{
snprintf(MODERR, MAXBUF,"Module %s is not within the modules directory.", modfile);
- this->Log(DEFAULT, MODERR);
+ Instance->Log(DEFAULT, MODERR);
return false;
}
if (ServerConfig::FileExists(modfile))
{
- for (unsigned int j = 0; j < Config->module_names.size(); j++)
+ for (unsigned int j = 0; j < Instance->Config->module_names.size(); j++)
{
- if (Config->module_names[j] == filename_str)
+ if (Instance->Config->module_names[j] == filename_str)
{
- this->Log(DEFAULT,"Module %s is already loaded, cannot load a module twice!",modfile);
+ Instance->Log(DEFAULT,"Module %s is already loaded, cannot load a module twice!",modfile);
snprintf(MODERR, MAXBUF, "Module already loaded");
return false;
}
@@ -452,11 +503,11 @@ bool InspIRCd::LoadModule(const char* filename)
/* This will throw a CoreException if there's a problem loading
* the module file or getting a pointer to the init_module symbol.
*/
- a = new ircd_module(this, modfile, "init_module");
+ a = new ircd_module(Instance, modfile, "init_module");
- factory[this->ModCount+1] = a;
+ handles[this->ModCount+1] = a;
- m = factory[this->ModCount+1]->CallInit();
+ m = handles[this->ModCount+1]->CallInit();
if(m)
{
@@ -465,81 +516,81 @@ bool InspIRCd::LoadModule(const char* filename)
if (v.API != API_VERSION)
{
delete m;
- this->Log(DEFAULT,"Unable to load %s: Incorrect module API version: %d (our version: %d)",modfile,v.API,API_VERSION);
+ Instance->Log(DEFAULT,"Unable to load %s: Incorrect module API version: %d (our version: %d)",modfile,v.API,API_VERSION);
snprintf(MODERR,MAXBUF,"Loader/Linker error: Incorrect module API version: %d (our version: %d)",v.API,API_VERSION);
return false;
}
else
{
- this->Log(DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
+ Instance->Log(DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
}
modules[this->ModCount+1] = m;
/* save the module and the module's classfactory, if
* this isnt done, random crashes can occur :/ */
- Config->module_names.push_back(filename);
+ Instance->Config->module_names.push_back(filename);
- char* x = &Config->implement_lists[this->ModCount+1][0];
+ char* x = &Instance->Config->implement_lists[this->ModCount+1][0];
for(int t = 0; t < 255; t++)
x[t] = 0;
modules[this->ModCount+1]->Implements(x);
for(int t = 0; t < 255; t++)
- Config->global_implementation[t] += Config->implement_lists[this->ModCount+1][t];
+ Instance->Config->global_implementation[t] += Instance->Config->implement_lists[this->ModCount+1][t];
}
else
{
- this->Log(DEFAULT, "Unable to load %s",modfile);
+ Instance->Log(DEFAULT, "Unable to load %s",modfile);
snprintf(MODERR,MAXBUF, "Probably missing init_module() entrypoint, but dlsym() didn't notice a problem");
return false;
}
}
catch (LoadModuleException& modexcept)
{
- this->Log(DEFAULT,"Unable to load %s: %s", modfile, modexcept.GetReason());
+ Instance->Log(DEFAULT,"Unable to load %s: %s", modfile, modexcept.GetReason());
snprintf(MODERR,MAXBUF,"Loader/Linker error: %s", modexcept.GetReason());
return false;
}
catch (FindSymbolException& modexcept)
{
- this->Log(DEFAULT,"Unable to load %s: %s", modfile, modexcept.GetReason());
+ Instance->Log(DEFAULT,"Unable to load %s: %s", modfile, modexcept.GetReason());
snprintf(MODERR,MAXBUF,"Loader/Linker error: %s", modexcept.GetReason());
return false;
}
catch (CoreException& modexcept)
{
- this->Log(DEFAULT,"Unable to load %s: %s",modfile,modexcept.GetReason());
+ Instance->Log(DEFAULT,"Unable to load %s: %s",modfile,modexcept.GetReason());
snprintf(MODERR,MAXBUF,"Factory function of %s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
return false;
}
}
else
{
- this->Log(DEFAULT,"InspIRCd: startup: Module Not Found %s",modfile);
+ Instance->Log(DEFAULT,"InspIRCd: startup: Module Not Found %s",modfile);
snprintf(MODERR,MAXBUF,"Module file could not be found");
return false;
}
this->ModCount++;
- FOREACH_MOD_I(this,I_OnLoadModule,OnLoadModule(modules[this->ModCount],filename_str));
+ FOREACH_MOD_I(Instance,I_OnLoadModule,OnLoadModule(modules[this->ModCount],filename_str));
// now work out which modules, if any, want to move to the back of the queue,
// and if they do, move them there.
std::vector<std::string> put_to_back;
std::vector<std::string> put_to_front;
std::map<std::string,std::string> put_before;
std::map<std::string,std::string> put_after;
- for (unsigned int j = 0; j < Config->module_names.size(); j++)
+ for (unsigned int j = 0; j < Instance->Config->module_names.size(); j++)
{
if (modules[j]->Prioritize() == PRIORITY_LAST)
- put_to_back.push_back(Config->module_names[j]);
+ put_to_back.push_back(Instance->Config->module_names[j]);
else if (modules[j]->Prioritize() == PRIORITY_FIRST)
- put_to_front.push_back(Config->module_names[j]);
+ put_to_front.push_back(Instance->Config->module_names[j]);
else if ((modules[j]->Prioritize() & 0xFF) == PRIORITY_BEFORE)
- put_before[Config->module_names[j]] = Config->module_names[modules[j]->Prioritize() >> 8];
+ put_before[Instance->Config->module_names[j]] = Instance->Config->module_names[modules[j]->Prioritize() >> 8];
else if ((modules[j]->Prioritize() & 0xFF) == PRIORITY_AFTER)
- put_after[Config->module_names[j]] = Config->module_names[modules[j]->Prioritize() >> 8];
+ put_after[Instance->Config->module_names[j]] = Instance->Config->module_names[modules[j]->Prioritize() >> 8];
}
for (unsigned int j = 0; j < put_to_back.size(); j++)
MoveToLast(put_to_back[j]);
@@ -549,15 +600,15 @@ bool InspIRCd::LoadModule(const char* filename)
MoveBefore(j->first,j->second);
for (std::map<std::string,std::string>::iterator j = put_after.begin(); j != put_after.end(); j++)
MoveAfter(j->first,j->second);
- BuildISupport();
+ Instance->BuildISupport();
return true;
}
-long InspIRCd::PriorityAfter(const std::string &modulename)
+long ModuleManager::PriorityAfter(const std::string &modulename)
{
- for (unsigned int j = 0; j < this->Config->module_names.size(); j++)
+ for (unsigned int j = 0; j < Instance->Config->module_names.size(); j++)
{
- if (this->Config->module_names[j] == modulename)
+ if (Instance->Config->module_names[j] == modulename)
{
return ((j << 8) | PRIORITY_AFTER);
}
@@ -565,11 +616,11 @@ long InspIRCd::PriorityAfter(const std::string &modulename)
return PRIORITY_DONTCARE;
}
-long InspIRCd::PriorityBefore(const std::string &modulename)
+long ModuleManager::PriorityBefore(const std::string &modulename)
{
- for (unsigned int j = 0; j < this->Config->module_names.size(); j++)
+ for (unsigned int j = 0; j < Instance->Config->module_names.size(); j++)
{
- if (this->Config->module_names[j] == modulename)
+ if (Instance->Config->module_names[j] == modulename)
{
return ((j << 8) | PRIORITY_BEFORE);
}
@@ -577,7 +628,7 @@ long InspIRCd::PriorityBefore(const std::string &modulename)
return PRIORITY_DONTCARE;
}
-bool InspIRCd::PublishFeature(const std::string &FeatureName, Module* Mod)
+bool ModuleManager::PublishFeature(const std::string &FeatureName, Module* Mod)
{
if (Features.find(FeatureName) == Features.end())
{
@@ -587,7 +638,7 @@ bool InspIRCd::PublishFeature(const std::string &FeatureName, Module* Mod)
return false;
}
-bool InspIRCd::UnpublishFeature(const std::string &FeatureName)
+bool ModuleManager::UnpublishFeature(const std::string &FeatureName)
{
featurelist::iterator iter = Features.find(FeatureName);
@@ -598,7 +649,7 @@ bool InspIRCd::UnpublishFeature(const std::string &FeatureName)
return true;
}
-Module* InspIRCd::FindFeature(const std::string &FeatureName)
+Module* ModuleManager::FindFeature(const std::string &FeatureName)
{
featurelist::iterator iter = Features.find(FeatureName);
@@ -608,7 +659,7 @@ Module* InspIRCd::FindFeature(const std::string &FeatureName)
return iter->second;
}
-bool InspIRCd::PublishInterface(const std::string &InterfaceName, Module* Mod)
+bool ModuleManager::PublishInterface(const std::string &InterfaceName, Module* Mod)
{
interfacelist::iterator iter = Interfaces.find(InterfaceName);
@@ -627,7 +678,7 @@ bool InspIRCd::PublishInterface(const std::string &InterfaceName, Module* Mod)
return false;
}
-bool InspIRCd::UnpublishInterface(const std::string &InterfaceName, Module* Mod)
+bool ModuleManager::UnpublishInterface(const std::string &InterfaceName, Module* Mod)
{
interfacelist::iterator iter = Interfaces.find(InterfaceName);
@@ -647,7 +698,7 @@ bool InspIRCd::UnpublishInterface(const std::string &InterfaceName, Module* Mod)
return false;
}
-modulelist* InspIRCd::FindInterface(const std::string &InterfaceName)
+modulelist* ModuleManager::FindInterface(const std::string &InterfaceName)
{
interfacelist::iterator iter = Interfaces.find(InterfaceName);
if (iter == Interfaces.end())
@@ -656,7 +707,7 @@ modulelist* InspIRCd::FindInterface(const std::string &InterfaceName)
return &(iter->second.second);
}
-void InspIRCd::UseInterface(const std::string &InterfaceName)
+void ModuleManager::UseInterface(const std::string &InterfaceName)
{
interfacelist::iterator iter = Interfaces.find(InterfaceName);
if (iter != Interfaces.end())
@@ -664,14 +715,14 @@ void InspIRCd::UseInterface(const std::string &InterfaceName)
}
-void InspIRCd::DoneWithInterface(const std::string &InterfaceName)
+void ModuleManager::DoneWithInterface(const std::string &InterfaceName)
{
interfacelist::iterator iter = Interfaces.find(InterfaceName);
if (iter != Interfaces.end())
iter->second.first--;
}
-std::pair<int,std::string> InspIRCd::GetInterfaceInstanceCount(Module* m)
+std::pair<int,std::string> ModuleManager::GetInterfaceInstanceCount(Module* m)
{
for (interfacelist::iterator iter = Interfaces.begin(); iter != Interfaces.end(); iter++)
{
@@ -686,18 +737,18 @@ std::pair<int,std::string> InspIRCd::GetInterfaceInstanceCount(Module* m)
return std::make_pair(0, "");
}
-const std::string& InspIRCd::GetModuleName(Module* m)
+const std::string& ModuleManager::GetModuleName(Module* m)
{
static std::string nothing; /* Prevent compiler warning */
- if (!this->GetModuleCount())
+ if (!this->GetCount())
return nothing;
- for (int i = 0; i <= this->GetModuleCount(); i++)
+ for (int i = 0; i <= this->GetCount(); i++)
{
if (this->modules[i] == m)
{
- return this->Config->module_names[i];
+ return Instance->Config->module_names[i];
}
}
return nothing; /* As above */
@@ -888,11 +939,11 @@ bool InspIRCd::IsValidMask(const std::string &mask)
return true;
}
-Module* InspIRCd::FindModule(const std::string &name)
+Module* ModuleManager::Find(const std::string &name)
{
- for (int i = 0; i <= this->GetModuleCount(); i++)
+ for (int i = 0; i <= this->GetCount(); i++)
{
- if (this->Config->module_names[i] == name)
+ if (Instance->Config->module_names[i] == name)
{
return this->modules[i];
}
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 5d8eeef7d..a78e8c61b 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -713,7 +713,7 @@ class ModuleSQL : public Module
ModuleSQL(InspIRCd* Me)
: Module::Module(Me), rehashing(false)
{
- ServerInstance->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQLutils");
Conf = new ConfigReader(ServerInstance);
PublicServerInstance = ServerInstance;
@@ -730,24 +730,24 @@ class ModuleSQL : public Module
throw ModuleException("m_mysql: Failed to create dispatcher thread: " + std::string(strerror(errno)));
}
- if (!ServerInstance->PublishFeature("SQL", this))
+ if (!ServerInstance->Modules->PublishFeature("SQL", this))
{
/* Tell worker thread to exit NOW */
giveup = true;
throw ModuleException("m_mysql: Unable to publish feature 'SQL'");
}
- ServerInstance->PublishInterface("SQL", this);
+ ServerInstance->Modules->PublishInterface("SQL", this);
}
virtual ~ModuleSQL()
{
giveup = true;
ClearAllConnections();
- DELETE(Conf);
- ServerInstance->UnpublishInterface("SQL", this);
- ServerInstance->UnpublishFeature("SQL");
- ServerInstance->DoneWithInterface("SQLutils");
+ delete Conf;
+ ServerInstance->Modules->UnpublishInterface("SQL", this);
+ ServerInstance->Modules->UnpublishFeature("SQL");
+ ServerInstance->Modules->DoneWithInterface("SQLutils");
}
@@ -886,4 +886,3 @@ void* DispatcherThread(void* arg)
}
MODULE_INIT(ModuleSQL);
-
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 393cbd1d7..0bc7dfd1c 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -723,20 +723,20 @@ class ModulePgSQL : public Module
ModulePgSQL(InspIRCd* Me)
: Module::Module(Me), currid(0)
{
- ServerInstance->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQLutils");
sqlsuccess = new char[strlen(SQLSUCCESS)+1];
strlcpy(sqlsuccess, SQLSUCCESS, strlen(SQLSUCCESS));
- if (!ServerInstance->PublishFeature("SQL", this))
+ if (!ServerInstance->Modules->PublishFeature("SQL", this))
{
throw ModuleException("BUG: PgSQL Unable to publish feature 'SQL'");
}
ReadConf();
- ServerInstance->PublishInterface("SQL", this);
+ ServerInstance->Modules->PublishInterface("SQL", this);
}
virtual ~ModulePgSQL()
@@ -745,9 +745,9 @@ class ModulePgSQL : public Module
ServerInstance->Timers->DelTimer(retimer);
ClearAllConnections();
delete[] sqlsuccess;
- ServerInstance->UnpublishInterface("SQL", this);
- ServerInstance->UnpublishFeature("SQL");
- ServerInstance->DoneWithInterface("SQLutils");
+ ServerInstance->Modules->UnpublishInterface("SQL", this);
+ ServerInstance->Modules->UnpublishFeature("SQL");
+ ServerInstance->Modules->DoneWithInterface("SQLutils");
}
void Implements(char* List)
@@ -984,4 +984,3 @@ void SQLConn::DelayReconnect()
}
MODULE_INIT(ModulePgSQL);
-
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index 6b05ee521..01d5733af 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -40,14 +40,14 @@ public:
ModuleSQLAuth(InspIRCd* Me)
: Module::Module(Me)
{
- ServerInstance->UseInterface("SQLutils");
- ServerInstance->UseInterface("SQL");
+ ServerInstance->Modules->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQL");
- SQLutils = ServerInstance->FindModule("m_sqlutils.so");
+ SQLutils = ServerInstance->Modules->Find("m_sqlutils.so");
if (!SQLutils)
throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so.");
- SQLprovider = ServerInstance->FindFeature("SQL");
+ SQLprovider = ServerInstance->Modules->FindFeature("SQL");
if (!SQLprovider)
throw ModuleException("Can't find an SQL provider module. Please load one before attempting to load m_sqlauth.");
@@ -56,8 +56,8 @@ public:
virtual ~ModuleSQLAuth()
{
- ServerInstance->DoneWithInterface("SQL");
- ServerInstance->DoneWithInterface("SQLutils");
+ ServerInstance->Modules->DoneWithInterface("SQL");
+ ServerInstance->Modules->DoneWithInterface("SQLutils");
}
void Implements(char* List)
@@ -191,4 +191,3 @@ public:
};
MODULE_INIT(ModuleSQLAuth);
-
diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp
index 188f33447..fc929b94f 100644
--- a/src/modules/extra/m_sqllog.cpp
+++ b/src/modules/extra/m_sqllog.cpp
@@ -187,14 +187,14 @@ class ModuleSQLLog : public Module
ModuleSQLLog(InspIRCd* Me)
: Module::Module(Me)
{
- ServerInstance->UseInterface("SQLutils");
- ServerInstance->UseInterface("SQL");
+ ServerInstance->Modules->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQL");
- Module* SQLutils = ServerInstance->FindModule("m_sqlutils.so");
+ Module* SQLutils = ServerInstance->Modules->Find("m_sqlutils.so");
if (!SQLutils)
throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so.");
- SQLModule = ServerInstance->FindFeature("SQL");
+ SQLModule = ServerInstance->Modules->FindFeature("SQL");
OnRehash(NULL,"");
MyMod = this;
@@ -203,8 +203,8 @@ class ModuleSQLLog : public Module
virtual ~ModuleSQLLog()
{
- ServerInstance->DoneWithInterface("SQL");
- ServerInstance->DoneWithInterface("SQLutils");
+ ServerInstance->Modules->DoneWithInterface("SQL");
+ ServerInstance->Modules->DoneWithInterface("SQLutils");
}
void Implements(char* List)
@@ -311,4 +311,3 @@ class ModuleSQLLog : public Module
};
MODULE_INIT(ModuleSQLLog);
-
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 520869e21..bb312ce8a 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -35,16 +35,16 @@ public:
ModuleSQLOper(InspIRCd* Me)
: Module::Module(Me)
{
- ServerInstance->UseInterface("SQLutils");
- ServerInstance->UseInterface("SQL");
- ServerInstance->UseInterface("HashRequest");
+ ServerInstance->Modules->UseInterface("SQLutils");
+ ServerInstance->Modules->UseInterface("SQL");
+ ServerInstance->Modules->UseInterface("HashRequest");
/* Attempt to locate the md5 service provider, bail if we can't find it */
- HashModule = ServerInstance->FindModule("m_md5.so");
+ HashModule = ServerInstance->Modules->Find("m_md5.so");
if (!HashModule)
throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_sqloper.so.");
- SQLutils = ServerInstance->FindModule("m_sqlutils.so");
+ SQLutils = ServerInstance->Modules->Find("m_sqlutils.so");
if (!SQLutils)
throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqloper.so.");
@@ -53,9 +53,9 @@ public:
virtual ~ModuleSQLOper()
{
- ServerInstance->DoneWithInterface("SQL");
- ServerInstance->DoneWithInterface("SQLutils");
- ServerInstance->DoneWithInterface("HashRequest");
+ ServerInstance->Modules->DoneWithInterface("SQL");
+ ServerInstance->Modules->DoneWithInterface("SQLutils");
+ ServerInstance->Modules->DoneWithInterface("HashRequest");
}
void Implements(char* List)
@@ -91,7 +91,7 @@ public:
{
Module* target;
- target = ServerInstance->FindFeature("SQL");
+ target = ServerInstance->Modules->FindFeature("SQL");
if (target)
{
@@ -280,4 +280,3 @@ public:
};
MODULE_INIT(ModuleSQLOper);
-
diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp
index b470f99af..2edf28263 100644
--- a/src/modules/extra/m_sqlutils.cpp
+++ b/src/modules/extra/m_sqlutils.cpp
@@ -37,12 +37,12 @@ public:
ModuleSQLutils(InspIRCd* Me)
: Module::Module(Me)
{
- ServerInstance->PublishInterface("SQLutils", this);
+ ServerInstance->Modules->PublishInterface("SQLutils", this);
}
virtual ~ModuleSQLutils()
{
- ServerInstance->UnpublishInterface("SQLutils", this);
+ ServerInstance->Modules->UnpublishInterface("SQLutils", this);
}
void Implements(char* List)
@@ -235,4 +235,3 @@ public:
};
MODULE_INIT(ModuleSQLutils);
-
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 26f166996..de1f6d55f 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -90,7 +90,7 @@ class ModuleSSLGnuTLS : public Module
ModuleSSLGnuTLS(InspIRCd* Me)
: Module(Me)
{
- ServerInstance->PublishInterface("InspSocketHook", this);
+ ServerInstance->Modules->PublishInterface("InspSocketHook", this);
// Not rehashable...because I cba to reduce all the sizes of existing buffers.
inbufsize = ServerInstance->Config->NetBufferSize;
@@ -854,4 +854,3 @@ class ModuleSSLGnuTLS : public Module
};
MODULE_INIT(ModuleSSLGnuTLS);
-
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 00c4c5fa3..f7beaede5 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -133,7 +133,7 @@ class ModuleSSLOpenSSL : public Module
ModuleSSLOpenSSL(InspIRCd* Me)
: Module(Me), PublicInstance(Me)
{
- ServerInstance->PublishInterface("InspSocketHook", this);
+ ServerInstance->Modules->PublishInterface("InspSocketHook", this);
// Not rehashable...because I cba to reduce all the sizes of existing buffers.
inbufsize = ServerInstance->Config->NetBufferSize;
@@ -891,4 +891,3 @@ static int error_callback(const char *str, size_t len, void *u)
}
MODULE_INIT(ModuleSSLOpenSSL);
-
diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp
index f4e58b7b5..da0d36df8 100644
--- a/src/modules/extra/m_testclient.cpp
+++ b/src/modules/extra/m_testclient.cpp
@@ -41,7 +41,7 @@ public:
virtual void OnBackgroundTimer(time_t foo)
{
- Module* target = ServerInstance->FindFeature("SQL");
+ Module* target = ServerInstance->Modules->FindFeature("SQL");
if(target)
{
@@ -107,4 +107,3 @@ public:
};
MODULE_INIT(ModuleTestClient);
-
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index 974f1e1d4..a054a00ef 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -74,7 +74,7 @@ class ModuleAuditorium : public Module
Priority Prioritize()
{
/* To ensure that we get priority over namesx for names list generation on +u channels */
- return (Priority)ServerInstance->PriorityBefore("m_namesx.so");
+ return (Priority)ServerInstance->Modules->PriorityBefore("m_namesx.so");
}
virtual Version GetVersion()
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index 66991425b..4f36fb8c9 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -48,7 +48,7 @@ public:
be = new BanException(ServerInstance);
if (!ServerInstance->AddMode(be, 'e'))
throw ModuleException("Could not add new modes!");
- ServerInstance->PublishInterface("ChannelBanList", this);
+ ServerInstance->Modules->PublishInterface("ChannelBanList", this);
}
virtual void Implements(char* List)
@@ -142,7 +142,7 @@ public:
{
ServerInstance->Modes->DelMode(be);
delete be;
- ServerInstance->UnpublishInterface("ChannelBanList", this);
+ ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 78cd24233..9ac440d5e 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -253,7 +253,7 @@ class ModuleBanRedirect : public Module
virtual void OnRehash(userrec* user, const std::string &param)
{
- ExceptionModule = ServerInstance->FindModule("m_banexception.so");
+ ExceptionModule = ServerInstance->Modules->Find("m_banexception.so");
}
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs)
@@ -295,7 +295,7 @@ class ModuleBanRedirect : public Module
/* tell them they're banned and are being transferred */
chanrec* destchan = ServerInstance->FindChan(redir->targetchan);
- if(destchan && ServerInstance->FindModule("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit))
+ if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit))
{
user->WriteServ("474 %s %s :Cannot join channel (You are banned)", user->nick, chan->name);
return 1;
@@ -329,7 +329,7 @@ class ModuleBanRedirect : public Module
Priority Prioritize()
{
- return (Priority)ServerInstance->PriorityBefore("m_banexception.so");
+ return (Priority)ServerInstance->Modules->PriorityBefore("m_banexception.so");
}
};
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index d4c4c4529..8e80ad89a 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -311,10 +311,10 @@ class ModuleCloaking : public Module
ModuleCloaking(InspIRCd* Me)
: Module(Me)
{
- ServerInstance->UseInterface("HashRequest");
+ ServerInstance->Modules->UseInterface("HashRequest");
/* Attempt to locate the md5 service provider, bail if we can't find it */
- HashModule = ServerInstance->FindModule("m_md5.so");
+ HashModule = ServerInstance->Modules->Find("m_md5.so");
if (!HashModule)
throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_cloaking.so.");
@@ -332,7 +332,7 @@ class ModuleCloaking : public Module
{
ServerInstance->Modes->DelMode(cu);
DELETE(cu);
- ServerInstance->DoneWithInterface("HashRequest");
+ ServerInstance->Modules->DoneWithInterface("HashRequest");
}
virtual Version GetVersion()
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index d0ace07df..faf35d572 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -33,14 +33,14 @@ class cmd_gloadmodule : public command_t
if (ServerInstance->MatchText(ServerInstance->Config->ServerName, servername))
{
- if (ServerInstance->LoadModule(parameters[0]))
+ if (ServerInstance->Modules->Load(parameters[0]))
{
ServerInstance->WriteOpers("*** NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0],user->nick);
user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
}
else
{
- user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->Modules->LastError());
}
}
else
@@ -67,14 +67,14 @@ class cmd_gunloadmodule : public command_t
if (ServerInstance->MatchText(ServerInstance->Config->ServerName, servername))
{
- if (ServerInstance->UnloadModule(parameters[0]))
+ if (ServerInstance->Modules->Unload(parameters[0]))
{
ServerInstance->WriteOpers("*** MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0],user->nick);
user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
}
else
{
- user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->Modules->LastError());
}
}
else
@@ -101,13 +101,13 @@ class cmd_greloadmodule : public command_t
if (ServerInstance->MatchText(ServerInstance->Config->ServerName, servername))
{
- if (!ServerInstance->UnloadModule(parameters[0]))
+ if (!ServerInstance->Modules->Unload(parameters[0]))
{
- user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->Modules->LastError());
}
- if (!ServerInstance->LoadModule(parameters[0]))
+ if (!ServerInstance->Modules->Load(parameters[0]))
{
- user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->Modules->LastError());
}
ServerInstance->WriteOpers("*** MODULE '%s' GLOBALLY RELOADED BY '%s'",parameters[0],user->nick);
user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index cf85a3900..327732651 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -54,7 +54,7 @@ class ModuleHostChange : public Module
Priority Prioritize()
{
- return (Priority)ServerInstance->PriorityAfter("m_cloaking.so");
+ return (Priority)ServerInstance->Modules->PriorityAfter("m_cloaking.so");
}
void Implements(char* List)
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 9e89bd149..445af1826 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -117,11 +117,11 @@ class ModuleHttpStats : public Module
data << "</general>";
data << "<modulelist>";
- for (int i = 0; i <= ServerInstance->GetModuleCount(); i++)
+ for (int i = 0; i <= ServerInstance->Modules->GetCount(); i++)
{
if (!ServerInstance->Config->module_names[i].empty())
{
- Version v = ServerInstance->modules[i]->GetVersion();
+ Version v = ServerInstance->Modules->modules[i]->GetVersion();
data << "<module><name>" << ServerInstance->Config->module_names[i] << "</name><version>" <<
v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << "</version></module>";
}
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index e8d9127b2..a0a2388f0 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -81,7 +81,7 @@ class InvisibleMode : public ModeHandler
dest->SetMode('Q', adding);
/* Fix for bug #379 reported by stealth. On +/-Q make m_watch think the user has signed on/off */
- Module* m = ServerInstance->FindModule("m_watch.so");
+ Module* m = ServerInstance->Modules->Find("m_watch.so");
/* This must come before setting/unsetting the handler */
if (m && adding)
diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp
index 1810f8297..c689af320 100644
--- a/src/modules/m_inviteexception.cpp
+++ b/src/modules/m_inviteexception.cpp
@@ -46,7 +46,7 @@ public:
ie = new InviteException(ServerInstance);
if (!ServerInstance->AddMode(ie, 'I'))
throw ModuleException("Could not add new modes!");
- ServerInstance->PublishInterface("ChannelBanList", this);
+ ServerInstance->Modules->PublishInterface("ChannelBanList", this);
}
virtual void Implements(char* List)
@@ -139,7 +139,7 @@ public:
{
ServerInstance->Modes->DelMode(ie);
DELETE(ie);
- ServerInstance->UnpublishInterface("ChannelBanList", this);
+ ServerInstance->Modules->UnpublishInterface("ChannelBanList", this);
}
};
diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp
index 2fe1daf61..0c8d531e0 100644
--- a/src/modules/m_md5.cpp
+++ b/src/modules/m_md5.cpp
@@ -267,12 +267,12 @@ class ModuleMD5 : public Module
ModuleMD5(InspIRCd* Me)
: Module(Me), key(NULL), chars(NULL)
{
- ServerInstance->PublishInterface("HashRequest", this);
+ ServerInstance->Modules->PublishInterface("HashRequest", this);
}
virtual ~ModuleMD5()
{
- ServerInstance->UnpublishInterface("HashRequest", this);
+ ServerInstance->Modules->UnpublishInterface("HashRequest", this);
}
void Implements(char* List)
diff --git a/src/modules/m_oper_hash.cpp b/src/modules/m_oper_hash.cpp
index 79530e349..887b2d6a7 100644
--- a/src/modules/m_oper_hash.cpp
+++ b/src/modules/m_oper_hash.cpp
@@ -81,10 +81,10 @@ class ModuleOperHash : public Module
Conf = NULL;
OnRehash(NULL,"");
- ServerInstance->UseInterface("HashRequest");
+ ServerInstance->Modules->UseInterface("HashRequest");
/* Find all modules which implement the interface 'HashRequest' */
- modulelist* ml = ServerInstance->FindInterface("HashRequest");
+ modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest");
/* Did we find any modules? */
if (ml)
@@ -112,7 +112,7 @@ class ModuleOperHash : public Module
virtual ~ModuleOperHash()
{
- ServerInstance->DoneWithInterface("HashRequest");
+ ServerInstance->Modules->DoneWithInterface("HashRequest");
}
void Implements(char* List)
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index feb2afa85..c8d661890 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -149,7 +149,7 @@ class RemoveBase
tlevel = chartolevel(channel->GetPrefixChar(target));
}
- hasnokicks = (ServerInstance->FindModule("m_nokicks.so") && channel->IsModeSet('Q'));
+ hasnokicks = (ServerInstance->Modules->Find("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 ((!IS_LOCAL(user)) || (!supportnokicks || !hasnokicks || (ulevel == ULINE)))
diff --git a/src/modules/m_rpc_json.cpp b/src/modules/m_rpc_json.cpp
index 35557fa14..8de1b8a29 100644
--- a/src/modules/m_rpc_json.cpp
+++ b/src/modules/m_rpc_json.cpp
@@ -51,7 +51,7 @@ class ModuleRpcJson : public Module
public:
ModuleRpcJson(InspIRCd* Me) : Module(Me)
{
- ServerInstance->PublishInterface("JSON-RPC", this);
+ ServerInstance->Modules->PublishInterface("JSON-RPC", this);
json::rpc::add_method ("system.listMethods", (Module *)this, (void (Module::*)(HTTPRequest*, json::Value&, json::Value&))&ModuleRpcJson::system_list_methods);
json::rpc::add_method ("ircd.moduleVersion", (Module *)this, (void (Module::*)(HTTPRequest*, json::Value&, json::Value&))&ModuleRpcJson::MthModuleVersion);
}
@@ -95,7 +95,7 @@ class ModuleRpcJson : public Module
virtual ~ModuleRpcJson()
{
- ServerInstance->UnpublishInterface("JSON-RPC", this);
+ ServerInstance->Modules->UnpublishInterface("JSON-RPC", this);
}
virtual Version GetVersion()
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 797088d1c..e4fc76478 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -88,7 +88,7 @@ class ModuleSecureList : public Module
virtual Priority Prioritize()
{
- return (Priority)ServerInstance->PriorityBefore("m_safelist.so");
+ return (Priority)ServerInstance->Modules->PriorityBefore("m_safelist.so");
}
};
diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp
index 6875a5f94..1be4551c8 100644
--- a/src/modules/m_sha256.cpp
+++ b/src/modules/m_sha256.cpp
@@ -241,12 +241,12 @@ class ModuleSHA256 : public Module
ModuleSHA256(InspIRCd* Me) : Module(Me), key(NULL), chars(NULL)
{
- ServerInstance->PublishInterface("HashRequest", this);
+ ServerInstance->Modules->PublishInterface("HashRequest", this);
}
virtual ~ModuleSHA256()
{
- ServerInstance->UnpublishInterface("HashRequest", this);
+ ServerInstance->Modules->UnpublishInterface("HashRequest", this);
}
void Implements(char *List)
@@ -290,4 +290,3 @@ class ModuleSHA256 : public Module
};
MODULE_INIT(ModuleSHA256)
-
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 9d7b7db79..f0ba16cbb 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -36,7 +36,7 @@
ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me)
: Module(Me), max_local(0), max_global(0)
{
- ServerInstance->UseInterface("InspSocketHook");
+ ServerInstance->Modules->UseInterface("InspSocketHook");
Utils = new SpanningTreeUtilities(Me, this);
command_rconnect = new cmd_rconnect(ServerInstance, this, Utils);
ServerInstance->AddCommand(command_rconnect);
@@ -1449,7 +1449,7 @@ ModuleSpanningTree::~ModuleSpanningTree()
ServerInstance->Timers->DelTimer(RefreshTimer);
- ServerInstance->DoneWithInterface("InspSocketHook");
+ ServerInstance->Modules->DoneWithInterface("InspSocketHook");
}
Version ModuleSpanningTree::GetVersion()
@@ -1481,4 +1481,3 @@ Priority ModuleSpanningTree::Prioritize()
}
MODULE_INIT(ModuleSpanningTree)
-
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index fcfb21f68..8a413ab8d 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -125,7 +125,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string
* Note: If m_sha256.so is not loaded, we MUST fall back to plaintext with no
* HMAC challenge/response.
*/
- Module* sha256 = Instance->FindModule("m_sha256.so");
+ Module* sha256 = Instance->Modules->Find("m_sha256.so");
if (Utils->ChallengeResponse && sha256 && !challenge.empty())
{
/* XXX: This is how HMAC is supposed to be done:
@@ -279,9 +279,9 @@ std::string TreeSocket::MyCapabilities()
{
std::vector<std::string> modlist;
std::string capabilities;
- for (int i = 0; i <= this->Instance->GetModuleCount(); i++)
+ for (int i = 0; i <= this->Instance->Modules->GetCount(); i++)
{
- if (this->Instance->modules[i]->GetVersion().Flags & VF_COMMON)
+ if (this->Instance->Modules->modules[i]->GetVersion().Flags & VF_COMMON)
modlist.push_back(this->Instance->Config->module_names[i]);
}
sort(modlist.begin(),modlist.end());
@@ -365,7 +365,7 @@ void TreeSocket::SendCapabilities()
#endif
std::string extra;
/* Do we have sha256 available? If so, we send a challenge */
- if (Utils->ChallengeResponse && (Instance->FindModule("m_sha256.so")))
+ if (Utils->ChallengeResponse && (Instance->Modules->Find("m_sha256.so")))
{
this->SetOurChallenge(RandString(20));
extra = " CHALLENGE=" + this->GetOurChallenge();
@@ -495,7 +495,7 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
/* Challenge response, store their challenge for our password */
std::map<std::string,std::string>::iterator n = this->CapKeys.find("CHALLENGE");
- if (Utils->ChallengeResponse && (n != this->CapKeys.end()) && (Instance->FindModule("m_sha256.so")))
+ if (Utils->ChallengeResponse && (n != this->CapKeys.end()) && (Instance->Modules->Find("m_sha256.so")))
{
/* Challenge-response is on now */
this->SetTheirChallenge(n->second);
@@ -1400,4 +1400,3 @@ bool TreeSocket::OnDataReady()
*/
return (data && !*data);
}
-
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 7172656ee..dedf76786 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -73,7 +73,7 @@ bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &par
for (unsigned int i = 0; i < Instance->Config->module_names.size(); i++)
{
- Version V = Instance->modules[i]->GetVersion();
+ Version V = Instance->Modules->modules[i]->GetVersion();
char modulename[MAXBUF];
char flagstate[MAXBUF];
*flagstate = 0;
@@ -90,7 +90,7 @@ bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &par
strlcpy(modulename,Instance->Config->module_names[i].c_str(),256);
if (*source->oper)
{
- snprintf(strbuf, MAXBUF, "::%s 900 %s :0x%08lx %d.%d.%d.%d %s (%s)",Instance->Config->ServerName,source->nick,(long unsigned int)Instance->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
+ snprintf(strbuf, MAXBUF, "::%s 900 %s :0x%08lx %d.%d.%d.%d %s (%s)",Instance->Config->ServerName,source->nick,(long unsigned int)Instance->Modules->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
}
else
{
@@ -849,7 +849,7 @@ bool TreeSocket::ComparePass(const std::string &ours, const std::string &theirs)
/* One or both of us specified hmac sha256, but we don't have sha256 module loaded!
* We can't allow this password as valid.
*/
- if (!Instance->FindModule("m_sha256.so") || !Utils->ChallengeResponse)
+ if (!Instance->Modules->Find("m_sha256.so") || !Utils->ChallengeResponse)
return false;
else
/* Straight string compare of hashes */
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index dcce230ac..705566d44 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -179,7 +179,7 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT
this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID());
- modulelist* ml = ServerInstance->FindInterface("InspSocketHook");
+ modulelist* ml = ServerInstance->Modules->FindInterface("InspSocketHook");
/* Did we find any modules? */
if (ml)
@@ -664,4 +664,3 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name)
}
return NULL;
}
-
diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp
index 190c84878..41534eca4 100644
--- a/src/modules/m_uhnames.cpp
+++ b/src/modules/m_uhnames.cpp
@@ -54,7 +54,7 @@ class ModuleUHNames : public Module
Priority Prioritize()
{
- return (Priority)ServerInstance->PriorityBefore("m_namesx.so");
+ return (Priority)ServerInstance->Modules->PriorityBefore("m_namesx.so");
}
virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
@@ -92,4 +92,3 @@ class ModuleUHNames : public Module
};
MODULE_INIT(ModuleUHNames)
-