summaryrefslogtreecommitdiff
path: root/src/core/sessionManager.hpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-06-12 21:41:41 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-06-13 20:22:51 +0800
commit6f7b994684032060f0a2d7af82f4f3572293b8d6 (patch)
tree793d328cbcd6761365267550b55db45aee9b21fc /src/core/sessionManager.hpp
parent6a51ab4525c59e9fe2bdbd92493019b0a98c6b94 (diff)
internal!: organized internal structure, using cmake now
Diffstat (limited to 'src/core/sessionManager.hpp')
-rw-r--r--src/core/sessionManager.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/sessionManager.hpp b/src/core/sessionManager.hpp
index e84226c..71bcc5f 100644
--- a/src/core/sessionManager.hpp
+++ b/src/core/sessionManager.hpp
@@ -1,9 +1,9 @@
#pragma once
#include "../debug/format.hpp"
-#include "../misc/memory.hpp"
#include "chatManager.hpp"
#include "session.hpp"
+#include <memory>
#include <thread>
#include <vector>
@@ -15,22 +15,22 @@ class CSessionManager {
void newSession();
void run();
- void broadcast(const std::string &msg, std::optional<WP<CSession>> self = std::nullopt) const; // second param only specified when we want to exclude the sender
- void kick(WP<CSession> session, const bool kill = false, const std::string &reason = "");
+ void broadcast(const std::string &msg, std::optional<std::weak_ptr<CSession>> self = std::nullopt) const; // second param only specified when we want to exclude the sender
+ void kick(std::weak_ptr<CSession> session, const bool kill = false, const std::string &reason = "");
void addSession(const CSession &session);
bool nameExists(const std::string &name);
void shutdownSessions();
- SP<CSession> getByName(const std::string &name) const;
- SP<CSession> getByIp(const std::string &ip) const;
- std::vector<SP<CSession>> getSessions() const;
+ std::shared_ptr<CSession> getByName(const std::string &name) const;
+ std::shared_ptr<CSession> getByIp(const std::string &ip) const;
+ std::vector<std::shared_ptr<CSession>> getSessions() const;
private:
void broadcast(const CChatManager::SMessage &msg) const;
- std::vector<std::pair<std::jthread, SP<CSession>>> m_vSessions;
+ std::vector<std::pair<std::jthread, std::shared_ptr<CSession>>> m_vSessions;
friend class CChatManager;
};
-inline SP<CSessionManager> g_pSessionManager;
+inline std::shared_ptr<CSessionManager> g_pSessionManager;