Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
chat_interface.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2015 est31 <MTest31@outlook.com>
4
5#pragma once
6
7#include "util/container.h"
8#include <string>
9#include <queue>
10#include "irrlichttypes.h"
11
18
19class ChatEvent {
20protected:
21 ChatEvent(ChatEventType a_type) { type = a_type; }
22public:
24};
25
28 u64 a_game_time,
29 u32 a_time) :
31 game_time(a_game_time),
32 time(a_time)
33 {}
34
36 u32 time;
37};
38
39struct ChatEventNick : public ChatEvent {
41 const std::string &a_nick) :
42 ChatEvent(a_type), // one of CET_NICK_ADD, CET_NICK_REMOVE
43 nick(a_nick)
44 {}
45
46 std::string nick;
47};
48
49struct ChatEventChat : public ChatEvent {
50 ChatEventChat(const std::string &a_nick,
51 const std::wstring &an_evt_msg) :
53 nick(a_nick),
54 evt_msg(an_evt_msg)
55 {}
56
57 std::string nick;
58 std::wstring evt_msg;
59};
60
62 MutexedQueue<ChatEvent *> command_queue; // chat backend --> server
63 MutexedQueue<ChatEvent *> outgoing_queue; // server --> chat backend
64};
ChatEventType
Definition chat_interface.h:12
@ CET_CHAT
Definition chat_interface.h:13
@ CET_NICK_REMOVE
Definition chat_interface.h:15
@ CET_TIME_INFO
Definition chat_interface.h:16
@ CET_NICK_ADD
Definition chat_interface.h:14
Definition chat_interface.h:19
ChatEvent(ChatEventType a_type)
Definition chat_interface.h:21
ChatEventType type
Definition chat_interface.h:23
Definition container.h:117
Definition chat_interface.h:49
std::string nick
Definition chat_interface.h:57
ChatEventChat(const std::string &a_nick, const std::wstring &an_evt_msg)
Definition chat_interface.h:50
std::wstring evt_msg
Definition chat_interface.h:58
Definition chat_interface.h:39
std::string nick
Definition chat_interface.h:46
ChatEventNick(ChatEventType a_type, const std::string &a_nick)
Definition chat_interface.h:40
Definition chat_interface.h:26
ChatEventTimeInfo(u64 a_game_time, u32 a_time)
Definition chat_interface.h:27
u64 game_time
Definition chat_interface.h:35
u32 time
Definition chat_interface.h:36
Definition chat_interface.h:61
MutexedQueue< ChatEvent * > command_queue
Definition chat_interface.h:62
MutexedQueue< ChatEvent * > outgoing_queue
Definition chat_interface.h:63