X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=6510c9423f19bb51f500096308471aa8649d5077;hb=eeb18ee6e3b1b07574a7f0fda2c0c20ac3f773df;hp=4c0af3bace5e40baac7f348afb9a164f07d3a5a2;hpb=fbc73e20784b055485f676096e758d6aeed62e0c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index 4c0af3bac..6510c9423 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -121,7 +121,6 @@ ModResult Module::OnChangeLocalUserGECOS(LocalUser*, const std::string&) { Detac ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPreTopicChange); return MOD_RES_PASSTHRU; } void Module::OnEvent(Event&) { DetachEvent(I_OnEvent); } ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { DetachEvent(I_OnPassCompare); return MOD_RES_PASSTHRU; } -void Module::OnGlobalOper(User*) { DetachEvent(I_OnGlobalOper); } void Module::OnPostConnect(User*) { DetachEvent(I_OnPostConnect); } void Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&, MessageType) { DetachEvent(I_OnUserMessage); } void Module::OnUserInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserInvite); } @@ -178,7 +177,7 @@ ModuleManager::~ModuleManager() bool ModuleManager::Attach(Implementation i, Module* mod) { - if (std::find(EventHandlers[i].begin(), EventHandlers[i].end(), mod) != EventHandlers[i].end()) + if (stdalgo::isin(EventHandlers[i], mod)) return false; EventHandlers[i].push_back(mod); @@ -685,8 +684,10 @@ void dynamic_reference_base::SetProvider(const std::string& newname) void dynamic_reference_base::resolve() { - std::multimap::iterator i = ServerInstance->Modules->DataProviders.find(name); - if (i != ServerInstance->Modules->DataProviders.end()) + // Because find() may return any element with a matching key in case count(key) > 1 use lower_bound() + // to ensure a dynref with the same name as another one resolves to the same object + std::multimap::iterator i = ServerInstance->Modules.DataProviders.lower_bound(name); + if ((i != ServerInstance->Modules.DataProviders.end()) && (i->first == this->name)) value = static_cast(i->second); else value = NULL;