summaryrefslogtreecommitdiff
path: root/src/core/chatManager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/chatManager.hpp')
-rw-r--r--src/core/chatManager.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/chatManager.hpp b/src/core/chatManager.hpp
new file mode 100644
index 0000000..bd305de
--- /dev/null
+++ b/src/core/chatManager.hpp
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <string>
+#include <vector>
+
+class CSession;
+
+class CChatManager {
+ public:
+ CChatManager();
+ ~CChatManager();
+ struct SMessage {
+ std::string msg;
+ std::string username;
+ std::optional<std::weak_ptr<CSession>> sender = std::nullopt;
+ bool admin = false;
+ };
+ void newMessage(const SMessage &msg);
+ std::string fmtBroadcastMessage(const SMessage &msg);
+
+ std::vector<SMessage> getChat() const;
+};
+inline std::unique_ptr<CChatManager> g_pChatManager;