*/
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
* @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
/** 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();
}
}
user->WriteServ("901 %s :End of MODULES list",user->nick);
-
+ */
return CMD_SUCCESS;
}
}
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.
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());
+ */
}
}
*/
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;
}
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?
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())
{
v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << "</version></module>";
}
}
+ */
data << "</modulelist>";
data << "<channellist>";
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++)
{