diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 18:01:42 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 22:49:45 +0800 |
| commit | 815c3955dbd9ff7e1a427cf4bc66da38b581b178 (patch) | |
| tree | 37b7b20175aeadf789e990fac7bd364792dd7e49 /src/sessionManager.hpp | |
| parent | a7cd7d8eb37c50554ae7c75f2ba94db74d293a1b (diff) | |
feat: join and leave message
internal: refactored messaging management, use instnace pointer for
verification of session
Diffstat (limited to 'src/sessionManager.hpp')
| -rw-r--r-- | src/sessionManager.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<std::jthread, std::shared_ptr<CSession>> *newSession(); void run(); - void broadcast(const std::string &msg) const; + void broadcast(const std::string &msg, std::optional<uintptr_t> 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<std::jthread, std::shared_ptr<CSession>> *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<std::shared_ptr<CSession>> getSessions() const; private: - void broadcastChat(const CChatManager::SMessage &msg) const; + void broadcast(const CChatManager::SMessage &msg) const; std::vector<std::pair<std::jthread, std::shared_ptr<CSession>>> m_vSessions; |
