summaryrefslogtreecommitdiff
path: root/src/sessionManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sessionManager.cpp')
-rw-r--r--src/sessionManager.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp
index 51bede4..0e27367 100644
--- a/src/sessionManager.cpp
+++ b/src/sessionManager.cpp
@@ -45,13 +45,12 @@ void CSessionManager::broadcast(const std::string &msg) const {
session->write(msg);
}
-void CSessionManager::broadcastChat(const std::string &msg, const std::string &username) const {
+void CSessionManager::broadcastChat(const CChatManager::SMessage &msg) const {
for (const auto &[thread, session] : m_vSessions) {
if (!session)
continue;
- auto name = session->getName();
- if (name != username)
- session->write(msg);
+
+ session->writeChat(msg);
}
}
@@ -83,8 +82,8 @@ void CSessionManager::kick(std::pair<std::jthread, std::shared_ptr<CSession>> *s
auto it = std::ranges::find_if(m_vSessions, [session](const auto &s) { return s.second.get() == session->second.get(); });
if (it != m_vSessions.end()) {
- if (!reason.empty())
- it->second->write(reason);
+ if (!reason.empty())
+ it->second->write(reason);
const auto native_handle = it->first.native_handle();
if (it->first.joinable())
it->first.detach(); // .detach the thread since it's removing itself