X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=8af5b95e33e1153d9b298ae212de4f19fc78b1d6;hb=e245dbbad7e91f232482374e9166f18782eaafa0;hp=bf5506d6876c23ad5e0157df2b6740ad0b4783ae;hpb=a9754ce49bf616c1d18556e19dd213d9ed54fcfc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index bf5506d68..8af5b95e3 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -34,24 +34,15 @@ void dynamic_reference_base::reset_all() } // Version is a simple class for holding a modules version number -template<> -VersionBase::VersionBase(const std::string &desc, int flags) -: description(desc), Flags(flags) +Version::Version(const std::string &desc, int flags) : description(desc), Flags(flags) { } -template<> -VersionBase::VersionBase(const std::string &desc, int flags, const std::string& linkdata) +Version::Version(const std::string &desc, int flags, const std::string& linkdata) : description(desc), Flags(flags), link_data(linkdata) { } -template<> -bool VersionBase::CanLink(const std::string& other_data) -{ - return link_data == other_data; -} - Request::Request(Module* src, Module* dst, const char* idstr) : id(idstr), source(src), dest(dst) { @@ -171,7 +162,7 @@ void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; } void Module::OnHookIO(StreamSocket*, ListenSocket*) { } ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { return MOD_RES_PASSTHRU; } -void Module::OnSendWhoLine(User*, const std::vector&, User*, Channel*, std::string&) { } +void Module::OnSendWhoLine(User*, const std::vector&, User*, std::string&) { } ModuleManager::ModuleManager() : ModCount(0) { @@ -395,6 +386,29 @@ void ModuleManager::DoSafeUnload(Module* mod) ServerInstance->BuildISupport(); } +void ModuleManager::UnloadAll() +{ + /* We do this more than once, so that any service providers get a + * chance to be unhooked by the modules using them, but then get + * a chance to be removed themsleves. + * + * Note: this deliberately does NOT delete the DLLManager objects + */ + for (int tries = 0; tries < 4; tries++) + { + std::map::iterator i = Modules.begin(); + while (i != Modules.end()) + { + std::map::iterator me = i++; + if (CanUnload(me->second)) + { + DoSafeUnload(me->second); + } + } + ServerInstance->GlobalCulls.Apply(); + } +} + std::string& ModuleManager::LastError() { return LastModuleError;