- if (modfind->second.second->GetVersion().Flags & VF_STATIC)
- {
- Instance->Log(DEFAULT,"Failed to unload STATIC module %s",filename);
- snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)");
- return false;
- }
- std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modfind->second.second);
- if (intercount.first > 0)
- {
- Instance->Log(DEFAULT,"Failed to unload module %s, being used by %d other(s) via interface '%s'",filename, intercount.first, intercount.second.c_str());
- snprintf(MODERR,MAXBUF,"Module not unloadable (Still in use by %d other module%s which %s using its interface '%s') -- unload dependent modules first!",
- intercount.first,
- intercount.first > 1 ? "s" : "",
- intercount.first > 1 ? "are" : "is",
- intercount.second.c_str());
- 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->clientlist->begin(); u != Instance->clientlist->end(); u++)
- {
- modfind->second.second->OnCleanup(TYPE_USER,u->second);
- }
-
- /* Tidy up any dangling resolvers */
- Instance->Res->CleanResolvers(modfind->second.second);
-
-
- FOREACH_MOD_I(Instance,I_OnUnloadModule,OnUnloadModule(modfind->second.second, modfind->first));
-
- this->DetachAll(modfind->second.second);
-
- Instance->Parser->RemoveCommands(filename);
-
- delete modfind->second.second;
- delete modfind->second.first;
- Modules.erase(modfind);
-
- Instance->Log(DEFAULT,"Module %s unloaded",filename);
- this->ModCount--;
- Instance->BuildISupport();
- return true;
- }
-
- Instance->Log(DEFAULT,"Module %s is not loaded, cannot unload it!",filename);
- snprintf(MODERR,MAXBUF,"Module not loaded");
- return false;
-}
-
-/* We must load the modules AFTER initializing the socket engine, now */
-void ModuleManager::LoadAll()
-{
- char configToken[MAXBUF];
- ModCount = -1;
-
- for(int count = 0; count < Instance->Config->ConfValueEnum(Instance->Config->config_data, "module"); count++)
+ Channel* chan = c->second;
+ ++c;
+ mod->OnCleanup(TYPE_CHANNEL, chan);
+ chan->doUnhookExtensions(items);
+ const UserMembList* users = chan->GetUsers();
+ for(UserMembCIter mi = users->begin(); mi != users->end(); mi++)
+ mi->second->doUnhookExtensions(items);
+ }
+ for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); )