]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Correctly ignore dummy argument to Version
[user/henk/code/inspircd.git] / src / modules.cpp
index a96dfe5e870f068cfabbe1ce3a0d67148e20babb..ee18112a1597dfaecad4a2bf42883be5af470df4 100644 (file)
@@ -27,8 +27,9 @@
 
 
 // version is a simple class for holding a modules version number
-Version::Version(const std::string &modv, int flags, int api_ver, const std::string& rev)
-: description(modv), version(rev), Flags(flags), API(api_ver)
+template<>
+VersionBase<API_VERSION>::VersionBase(const std::string &modv, int flags, int, const std::string& rev)
+: description(modv), version(rev), Flags(flags)
 {
 }
 
@@ -193,14 +194,13 @@ void              Module::OnChannelDelete(Channel*) { }
 ModResult      Module::OnSetAway(User*, const std::string &) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnUserList(User*, Channel*) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnWhoisLine(User*, User*, int&, std::string&) { return MOD_RES_PASSTHRU; }
-void           Module::OnBuildExemptList(MessageType, Channel*, User*, char, CUList&, const std::string&) { }
+void           Module::OnBuildNeighborList(User*, UserChanList&, std::map<User*,bool>&) { }
 void           Module::OnGarbageCollect() { }
 void           Module::OnText(User*, void*, int, const std::string&, char, CUList&) { }
 void           Module::OnRunTestSuite() { }
 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*, ListenSocketBase*) { }
-ModResult      Module::OnHostCycle(User*) { return MOD_RES_PASSTHRU; }
 void           Module::OnSendWhoLine(User*, User*, Channel*, std::string&) { }
 
 ModuleManager::ModuleManager() : ModCount(0)
@@ -440,19 +440,7 @@ bool ModuleManager::Load(const char* filename)
                        newmod->ModuleDLLFactory = newhandle;
                        Version v = newmod->GetVersion();
 
-                       if (v.API != API_VERSION)
-                       {
-                               DetachAll(newmod);
-                               delete newmod;
-                               delete newhandle;
-                               LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")";
-                               ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError);
-                               return false;
-                       }
-                       else
-                       {
-                               ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %s)%s", filename, v.API, v.version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
-                       }
+                       ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)%s", filename, v.version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
 
                        Modules[filename_str] = newmod;
                }
@@ -464,7 +452,9 @@ bool ModuleManager::Load(const char* filename)
                        return false;
                }
        }
-       /** XXX: Is there anything we can do about this mess? -- Brain */
+       /** XXX: Is there anything we can do about this mess? -- Brain
+        * Yeah, don't use exceptions without RAII. -- Daniel
+        */
        catch (LoadModuleException& modexcept)
        {
                DetachAll(newmod);
@@ -567,6 +557,7 @@ bool ModuleManager::Unload(const char* filename)
                this->DetachAll(modfind->second);
 
                ServerInstance->Parser->RemoveCommands(modfind->second);
+               ServerInstance->Modes->RemoveModes(modfind->second);
 
                ServerInstance->GlobalCulls.AddItem(modfind->second);
                Modules.erase(modfind);