3#include <librtmedius.h>
36 ChatMsg(
int nAccountId,
int nPlayer,
const char *pszText,
const char *pszSender)
37 : mAccountId(nAccountId), mPlayer(nPlayer), mText(pszText), mSender(pszSender) {
46 void *
operator new(
size_t nSize) {
47 return PoolMemAlloc(
static_cast<int>(nSize),
"ChatMsg", 0);
55 void operator delete(
void *pBlock) {
123 static bool Send(
int nChannel,
int nRecipient,
const char *pszText,
int nEcho);
136 static void SendPrivate(
int nChannel,
int nAccountId,
const char *pszText);
161 OnLobbyChat(
int nConnection,
int nType,
int nSize,
const rtMediusChatMessage *pMessage);
203 static MsgSink *FindHandler(
int nChannel);
215 static bool AllowLine();
int g_nChatMsgType
Identity that ChatMsg::Type() reports.
ChatMsg(int nAccountId, int nPlayer, const char *pszText, const char *pszSender)
Construct a line.
Definition chatmsg.h:36
static void AddHandler(int nChannel, MsgSink *pHandler)
Register the sink that receives the chat of a channel.
int Type() override
Report this message's registered identity.
Definition chatmsg.h:73
Message * Clone() override
Produce a heap copy of this message.
Definition chatmsg.h:64
static void SendPrivate(int nChannel, int nAccountId, const char *pszText)
Send a line of chat to one account only.
static void OnLobbyChat(int nConnection, int nType, int nSize, const rtMediusChatMessage *pMessage)
Deliver a line of chat from the lobby server to the sink of its channel.
int GetAccountId() const
Definition chatmsg.h:173
static void RemoveSink(int nChannel)
Forget the sink of a channel.
static void ClearPartialMessages()
Discard the lines whose remaining parts have not arrived.
void PrintExtra(PrnStream &stream) const override
Write the channel and the text.
int GetPlayer() const
Definition chatmsg.h:178
static bool Send(int nChannel, int nRecipient, const char *pszText, int nEcho)
Send a line of chat.
const char * GetSender() const
Definition chatmsg.h:183
const char * GetName() const override
Report this message's class name.
Definition chatmsg.h:82
const char * GetText() const
Definition chatmsg.h:188
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Receiver of engine messages.
Definition msgsink.h:21
Text output stream.
Definition prnstream.h:16
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.