- Instance->BuildISupport();
- return true;
-}
-
-bool ModuleManager::Unload(const char* filename)
-{
- std::string filename_str(filename);
- std::map<std::string, std::pair<ircd_module*, Module*> >::iterator modfind = Modules.find(filename);
-
- if (modfind != Modules.end())
- {
- if (modfind->second.second->GetVersion().Flags & VF_STATIC)
- {
- LastModuleError = "Module " + filename_str + " not unloadable (marked static)";
- Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
- return false;
- }
- std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modfind->second.second);
- if (intercount.first > 0)
- {
- LastModuleError = "Failed to unload module " + filename_str + ", being used by " + ConvToStr(intercount.first) + " other(s) via interface '" + intercount.second + "'";
- Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
- return false;
- }
-
- /* Give the module a chance to tidy out all its metadata */
- for (chan_hash::iterator c = Instance->chanlist->begin(); c != Instance->chanlist->end(); c++)
- {
- modfind->second.second->OnCleanup(TYPE_CHANNEL,c->second);
- }
- for (user_hash::iterator u = Instance->Users->clientlist->begin(); u != Instance->Users->clientlist->end(); u++)
- {
- modfind->second.second->OnCleanup(TYPE_USER,u->second);
- }
-
- /* Tidy up any dangling resolvers */
- Instance->Res->CleanResolvers(modfind->second.second);
-