]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Not yet tested: remove last vestiges of modules[] and module_names[] arrays.
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 4 Nov 2007 19:28:22 +0000 (19:28 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 4 Nov 2007 19:28:22 +0000 (19:28 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8514 e03df62e-2008-0410-955e-edbf42e46eb7

include/modules.h
src/commands/cmd_modules.cpp
src/commands/cmd_stats.cpp
src/inspircd.cpp
src/modules.cpp
src/modules/m_httpd_stats.cpp
src/modules/m_spanningtree/treesocket1.cpp

index 49fd0da50532c670fada2afe567f9400236af7c6..908a3e264042394ea70c2b19cb9318824cb3ca6e 100644 (file)
@@ -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
index f961b6268c68f230cbbef18d286be76931626958..a70477e693be18e13f7ad8c7d56bf2fb7c58a8c9 100644 (file)
@@ -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;
 }
index 74658a149a2cfd6c4d57c17be7aa786776c8b47c..4814c419e447c185824bd95fd5e416781225fe12 100644 (file)
@@ -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.
index 1f46fa875c15c613168ce0b4b96740247dedcaac..e5e9ad5b3c66788e5da55fd11190194f473b182a 100644 (file)
@@ -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;
 }
 
index 7bc9f94c4ffee801216513fdd3e16544dc8717cc..29c185f1a3116fe56a1fd54acdd07a8c52ab95d7 100644 (file)
@@ -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?
index 1022d1563360e5e46b2f5fa7d36227128dee47bd..ef1b87cb88fd4fd28636d2407a16f222e3c0f5eb 100644 (file)
@@ -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>";
index 18ae9b6cdcc40b2ac349ce9f5ba2b0f4dd6966ac..488607c96a411766a03d34f5a573dcf521c254c7 100644 (file)
@@ -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++)
        {