summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-04 19:28:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-04 19:28:22 +0000
commite1efa862f373aacefa027f346c0976f802818727 (patch)
tree2fc86b62ff306f219c36af763bcc587c43baced7
parent7fe5347210730622badcb6ed32d90114bd8cbeb4 (diff)
Not yet tested: remove last vestiges of modules[] and module_names[] arrays.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8514 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/modules.h14
-rw-r--r--src/commands/cmd_modules.cpp4
-rw-r--r--src/commands/cmd_stats.cpp2
-rw-r--r--src/inspircd.cpp19
-rw-r--r--src/modules.cpp9
-rw-r--r--src/modules/m_httpd_stats.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp7
7 files changed, 25 insertions, 34 deletions
diff --git a/include/modules.h b/include/modules.h
index 49fd0da50..908a3e264 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1642,18 +1642,6 @@ class CoreExport ModuleManager : public classbase
*/
Module* Find(const std::string &name);
- /** Remove a module handle pointer
- * @param j Index number of the module handle to remove
- * @return True if a handle existed at the given index, false otherwise
- */
- bool EraseHandle(unsigned int j);
-
- /** Remove a Module pointer
- * @param j Index number of the Module to remove
- * @return True if a handle existed at the given index, false otherwise
- */
- bool EraseModule(unsigned int j);
-
/** Publish a 'feature'.
* There are two ways for a module to find another module it depends on.
* Either by name, using InspIRCd::FindModule, or by feature, using this
@@ -1756,6 +1744,8 @@ class CoreExport ModuleManager : public classbase
* @return The module name or an empty string
*/
const std::string& GetModuleName(Module* m);
+
+ const std::vector<std::string> GetAllModuleNames(int filter);
};
/** This definition is used as shorthand for the various classes
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index f961b6268..a70477e69 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -39,7 +39,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /MODULES
*/
CmdResult CommandModules::Handle (const char**, int, User *user)
-{
+{/* XXX FIXME
for (unsigned int i = 0; i < ServerInstance->Config->module_names.size(); i++)
{
Version V = ServerInstance->Modules->modules[i]->GetVersion();
@@ -67,6 +67,6 @@ CmdResult CommandModules::Handle (const char**, int, User *user)
}
}
user->WriteServ("901 %s :End of MODULES list",user->nick);
-
+ */
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 74658a149..4814c419e 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -194,8 +194,6 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
}
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->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/inspircd.cpp b/src/inspircd.cpp
index 1f46fa875..e5e9ad5b3 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -103,11 +103,13 @@ void InspIRCd::Cleanup()
if (MyModCount)
{
/* Unload all modules, so they get a chance to clean up their listeners */
- for (int j = 0; j <= MyModCount; j++)
+ /*XXX FIXME
+ * for (int j = 0; j <= MyModCount; j++)
mymodnames.push_back(Config->module_names[j]);
for (int k = 0; k <= MyModCount; k++)
this->Modules->Unload(mymodnames[k].c_str());
+ */
}
}
@@ -715,18 +717,13 @@ int main(int argc, char ** argv)
*/
bool InspIRCd::AllModulesReportReady(User* user)
{
- if (!Config->global_implementation[I_OnCheckReady])
- return true;
-
- for (int i = 0; i <= this->Modules->GetCount(); i++)
+ for (EventHandlerIter i = Modules->EventHandlers[I_OnCheckReady].begin(); i != Modules->EventHandlers[I_OnCheckReady].end(); ++i)
{
- if (Config->implement_lists[i][I_OnCheckReady])
- {
- int res = this->Modules->modules[i]->OnCheckReady(user);
- if (!res)
- return false;
- }
+ int res = (*i)->OnCheckReady(user);
+ if (!res)
+ return false;
}
+
return true;
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 7bc9f94c4..29c185f1a 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -785,6 +785,15 @@ Module* ModuleManager::Find(const std::string &name)
return modfind->second.second;
}
+const std::vector<std::string> ModuleManager::GetAllModuleNames(int filter)
+{
+ std::vector<std::string> retval;
+ for (std::map<std::string, std::pair<ircd_module*, Module*> >::iterator x = Modules.begin(); x != Modules.end(); ++x)
+ if (!filter || (x->second.second->GetVersion().Flags & filter))
+ retval.push_back(x->first);
+ return retval;
+}
+
ConfigReader::ConfigReader(InspIRCd* Instance) : ServerInstance(Instance)
{
/* Is there any reason to load the entire config file again here?
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 1022d1563..ef1b87cb8 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -119,7 +119,8 @@ class ModuleHttpStats : public Module
data << "</general>";
data << "<modulelist>";
- for (int i = 0; i <= ServerInstance->Modules->GetCount(); i++)
+ /* XXX FIXME
+ * for (int i = 0; i <= ServerInstance->Modules->GetCount(); i++)
{
if (!ServerInstance->Config->module_names[i].empty())
{
@@ -128,6 +129,7 @@ class ModuleHttpStats : public Module
v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << "</version></module>";
}
}
+ */
data << "</modulelist>";
data << "<channellist>";
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 18ae9b6cd..488607c96 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -277,13 +277,8 @@ void TreeSocket::SendServers(TreeServer* Current, TreeServer* s, int hops)
std::string TreeSocket::MyCapabilities()
{
- std::vector<std::string> modlist;
+ std::vector<std::string> modlist = this->Instance->Modules->GetAllModuleNames(VF_COMMON);
std::string capabilities;
- for (int i = 0; i <= this->Instance->Modules->GetCount(); i++)
- {
- if (this->Instance->Modules->modules[i]->GetVersion().Flags & VF_COMMON)
- modlist.push_back(this->Instance->Config->module_names[i]);
- }
sort(modlist.begin(),modlist.end());
for (unsigned int i = 0; i < modlist.size(); i++)
{