summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
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/inspircd.cpp
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/inspircd.cpp')
-rw-r--r--src/inspircd.cpp29
1 files changed, 13 insertions, 16 deletions
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;
}
-