From 2405f25c6b5e1c824599b8a4d76e6bda0b083849 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 18 Jun 2025 12:37:19 +0800 Subject: internal: remove unused m_name --- src/server/clients.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/server/clients.cpp') diff --git a/src/server/clients.cpp b/src/server/clients.cpp index 1a11ed7..4d6308e 100644 --- a/src/server/clients.cpp +++ b/src/server/clients.cpp @@ -68,24 +68,6 @@ void Clients::broadcast(const SData &msg) { m_vDatas.push_back(msg); } -bool Clients::nameExists(const std::string &name) { - auto it = std::ranges::find_if(m_vClients, [&name](const auto &s) { return s.second->getName() == name; }); - - if (it != m_vClients.end()) { - if (!it->second->isValid()) { - kick(std::weak_ptr(it->second), true, "Connection lost"); - return false; - } - return true; - } - return false; -} - -SP Clients::getByName(const std::string &name) const { - auto it = std::ranges::find_if(m_vClients, [&name](const auto &s) { return s.second->getName() == name; }); - return it != m_vClients.end() ? it->second : nullptr; -} - SP Clients::getByIp(const std::string &ip) const { auto it = std::ranges::find_if(m_vClients, [&ip](const auto &s) { return s.second->getIp() == ip; }); return it != m_vClients.end() ? it->second : nullptr; @@ -106,7 +88,7 @@ void Clients::kick(WP clientWeak, const bool kill, const std::string &re for (auto it = m_vClients.begin(); it != m_vClients.end(); ++it) { if (it->second == client) { - if (client && !client->getName().empty()) + if (client) // this only exist when the client is registered // not sure why the second is null if (cb) -- cgit v1.2.3