summaryrefslogtreecommitdiff
path: root/src/core/chatManager.hpp
blob: 6e1d5a2d61f0f04cc1494c4f72ec73ca1396c875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include "../misc/memory.hpp"
#include <optional>
#include <string>
#include <vector>

class CSession;

class CChatManager {
  public:
	CChatManager();
	~CChatManager();
	struct SMessage {
		std::string					msg;
		std::string					username;
		std::optional<WP<CSession>> sender = std::nullopt;
		bool						admin  = false;
	};
	void		newMessage(const SMessage &msg);
	std::string fmtBroadcastMessage(const SMessage &msg);

	std::vector<SMessage> getChat() const;
};
inline UP<CChatManager> g_pChatManager;