X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=ee18112a1597dfaecad4a2bf42883be5af470df4;hb=c440038736f749a56dbac1badee5b2f099286117;hp=a96dfe5e870f068cfabbe1ce3a0d67148e20babb;hpb=8456cf5ccd44911f4e56538fe0880dd7fc7cd96d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index a96dfe5e8..ee18112a1 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -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::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&) { } 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);