When a server stops being ulined remove its users from the uline list.

This commit is contained in:
Sadie Powell 2024-10-10 14:47:24 +01:00
parent 522c202a9c
commit 5eb21f239b
3 changed files with 17 additions and 0 deletions

View File

@ -141,6 +141,9 @@ class CoreExport UserManager : public fakederef<UserManager>
*/
void RehashCloneCounts();
/** Rebuilds the list of services servers. Required when \<uline> settings change. */
void RehashULines();
/** Return the number of local and global clones of this user
* @param user The user to get the clone counts for
* @return The clone counts of this user. The returned reference is volatile - you

View File

@ -733,6 +733,7 @@ void ConfigReaderThread::Finish()
ServerInstance->FakeClient->server->description = Config->ServerDesc;
ServerInstance->ISupport.Build();
ServerInstance->Users.RehashULines();
ServerInstance->Logs->CloseLogs();
ServerInstance->Logs->OpenFileLogs();

View File

@ -353,6 +353,19 @@ void UserManager::RehashCloneCounts()
}
}
void UserManager::RehashULines()
{
UserManager::ULineList newulines;
const user_hash& users = ServerInstance->Users.GetUsers();
for (user_hash::const_iterator i = users.begin(); i != users.end(); ++i)
{
User* user = i->second;
if (user->server->IsULine())
newulines.push_back(user);
}
std::swap(ServerInstance->Users.all_ulines, newulines);
}
const UserManager::CloneCounts& UserManager::GetCloneCounts(User* user) const
{
CloneMap::const_iterator it = clonemap.find(user->GetCIDRMask());