Only remove extbans on unload if provided by the right module.

This commit is contained in:
Sadie Powell 2024-09-13 11:52:26 +01:00
parent 8b253d39a1
commit 45f10a7f6f
2 changed files with 8 additions and 2 deletions

View File

@ -116,6 +116,7 @@ public:
return *this;
}
inline T* ptr() const { return value; }
inline operator bool() const { return (value != nullptr); }
inline operator T*() const { return value; }
inline T* operator->() const { return value; }

View File

@ -153,8 +153,13 @@ ModResult ExtBanManager::GetStatus(ExtBan::ActingBase* extban, User* user, Chann
void ExtBanManager::DelExtBan(ExtBan::Base* extban)
{
byletter.erase(extban->GetLetter());
byname.erase(extban->GetName());
auto lit = byletter.find(extban->GetLetter());
if (lit != byletter.end() && lit->second->creator.ptr() == extban->creator.ptr())
byletter.erase(lit);
auto nit = byname.find(extban->GetName());
if (nit != byname.end() && nit->second->creator.ptr() == extban->creator.ptr())
byname.erase(nit);
}
ExtBan::Base* ExtBanManager::FindName(const std::string& xbname) const