]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
2.0.5 release
[user/henk/code/inspircd.git] / src / modules.cpp
index bf5506d6876c23ad5e0157df2b6740ad0b4783ae..8af5b95e33e1153d9b298ae212de4f19fc78b1d6 100644 (file)
@@ -34,24 +34,15 @@ void dynamic_reference_base::reset_all()
 }
 
 // Version is a simple class for holding a modules version number
-template<>
-VersionBase<API_VERSION>::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<API_VERSION>::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<API_VERSION>::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<std::string>&, User*, Channel*, std::string&) { }
+void           Module::OnSendWhoLine(User*, const std::vector<std::string>&, 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<std::string, Module*>::iterator i = Modules.begin();
+               while (i != Modules.end())
+               {
+                       std::map<std::string, Module*>::iterator me = i++;
+                       if (CanUnload(me->second))
+                       {
+                               DoSafeUnload(me->second);
+                       }
+               }
+               ServerInstance->GlobalCulls.Apply();
+       }
+}
+
 std::string& ModuleManager::LastError()
 {
        return LastModuleError;