void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { if (IS_LOCAL(user)) { if (oper_message != reason) ServerInstance->PI->SendMetaData(user, "operquit", oper_message); CmdBuilder(user, "QUIT").push_last(reason).Broadcast(); } else { // Hide the message if one of the following is true: // - User is being quit due to a netsplit and quietbursts is on // - Server is a silent uline TreeServer* server = TreeServer::Get(user); bool hide = (((server->IsDead()) && (Utils->quiet_bursts)) || (server->IsSilentULine())); if (!hide) { ServerInstance->SNO.WriteToSnoMask('Q', "Client exiting on server %s: %s (%s) [%s]", user->server->GetName().c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str()); } } // Regardless, update the UserCount TreeServer::Get(user)->UserCount--; }
unsigned int TreeServer::QuitUsers(const std::string& reason) { std::string publicreason = ServerInstance->Config->HideSplits ? "*.net *.split" : reason; const user_hash& users = ServerInstance->Users->GetUsers(); unsigned int original_size = users.size(); for (user_hash::const_iterator i = users.begin(); i != users.end(); ) { User* user = i->second; // Increment the iterator now because QuitUser() removes the user from the container ++i; TreeServer* server = TreeServer::Get(user); if (server->IsDead()) ServerInstance->Users->QuitUser(user, publicreason, &reason); } return original_size - users.size(); }