summaryrefslogtreecommitdiff
path: root/src/sessionManager.hpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-03-09 14:16:46 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-03-20 23:44:57 +0800
commit8ab26f85e474dcdbbb2c2fb94b6a087f71952bf8 (patch)
tree752c1129db2d363dfd96dd15d27c34f2e126a4e3 /src/sessionManager.hpp
parent938ca89e48c2a01d6aa072f01545fa2da585486c (diff)
feat: broadcast message from one client to the rest, making chat actually possible
fix(chatServer, CSessionManager): .join sessionThread properly cleanup(server): unused header
Diffstat (limited to 'src/sessionManager.hpp')
-rw-r--r--src/sessionManager.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sessionManager.hpp b/src/sessionManager.hpp
index eb881a7..ea5fce9 100644
--- a/src/sessionManager.hpp
+++ b/src/sessionManager.hpp
@@ -10,14 +10,18 @@ class CSessionManager {
public:
CSessionManager();
~CSessionManager();
- void enterLoop();
+
std::pair<std::jthread, std::shared_ptr<CSession>> *newSession(Hyprutils::OS::CFileDescriptor sockfd);
- void broadcast(const std::string &message, eFormatType type = NONE) const;
+
+ void enterLoop();
+ void broadcast(const std::string &msg, eFormatType type = NONE) const;
void kick(const CSession *session) const;
void addSession(const CSession &session);
void removeSession(std::pair<std::jthread, std::shared_ptr<CSession>> *session);
private:
+ void broadcastChat(const std::string &msg, const std::string &username) const;
std::vector<std::pair<std::jthread, std::shared_ptr<CSession>>> m_vSessions;
+ friend class CChatManager;
};
inline std::shared_ptr<CSessionManager> g_pSessionManager;