From 815c3955dbd9ff7e1a427cf4bc66da38b581b178 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 21 May 2025 18:01:42 +0800 Subject: feat: join and leave message internal: refactored messaging management, use instnace pointer for verification of session --- src/sessionManager.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/sessionManager.hpp') diff --git a/src/sessionManager.hpp b/src/sessionManager.hpp index 8e02a7d..6e946d6 100644 --- a/src/sessionManager.hpp +++ b/src/sessionManager.hpp @@ -15,7 +15,7 @@ class CSessionManager { std::pair> *newSession(); void run(); - void broadcast(const std::string &msg) const; + void broadcast(const std::string &msg, std::optional self = std::nullopt) const; // second param only specified when we want to exclude the sender void kick(CSession *session, const bool kill = false, const std::string &reason = ""); void kick(std::pair> *session, const bool kill = false, const std::string &reason = ""); void addSession(const CSession &session); @@ -25,10 +25,11 @@ class CSessionManager { CSession *getByName(const std::string &name) const; CSession *getByIp(const std::string &ip) const; + CSession *getByPtr(const uintptr_t &p) const; std::vector> getSessions() const; private: - void broadcastChat(const CChatManager::SMessage &msg) const; + void broadcast(const CChatManager::SMessage &msg) const; std::vector>> m_vSessions; -- cgit v1.2.3