Chat cleaner now active within ranking games (for testing it is also active in normal games). New protocol version for chat cleaner.

This commit is contained in:
lotodore
2011-01-30 18:28:44 +00:00
parent e041153b09
commit e55e39a979
9 changed files with 217 additions and 143 deletions
+139 -137
View File
@@ -13,192 +13,194 @@ using namespace std;
CleanerServer::CleanerServer(): config(0), blockConnection(false), m_recvBufUsed(0), secondsSinceLastConfigChange(0) CleanerServer::CleanerServer(): config(0), blockConnection(false), m_recvBufUsed(0), secondsSinceLastConfigChange(0)
{ {
config = new CleanerConfig; config = new CleanerConfig;
clientSecret = QString::fromUtf8(config->readConfigString("ClientAuthString").c_str()); clientSecret = QString::fromUtf8(config->readConfigString("ClientAuthString").c_str());
serverSecret = QString::fromUtf8(config->readConfigString("ServerAuthString").c_str()); serverSecret = QString::fromUtf8(config->readConfigString("ServerAuthString").c_str());
myMessageFilter = new MessageFilter(config); myMessageFilter = new MessageFilter(config);
tcpServer = new QTcpServer(); tcpServer = new QTcpServer();
tcpServer->setMaxPendingConnections(1); tcpServer->setMaxPendingConnections(1);
if (!tcpServer->listen(QHostAddress(QString::fromUtf8(config->readConfigString("HostAddress").c_str())), config->readConfigInt("DefaultListenPort")) ) { if (!tcpServer->listen(QHostAddress(QString::fromUtf8(config->readConfigString("HostAddress").c_str())), config->readConfigInt("DefaultListenPort")) ) {
qDebug() << QString("Unable to start the server: %1.").arg(tcpServer->errorString()); qDebug() << QString("Unable to start the server: %1.").arg(tcpServer->errorString());
return; return;
} }
qDebug() << QString("The server is running on port %1.").arg(tcpServer->serverPort()); qDebug() << QString("The server is running on port %1.").arg(tcpServer->serverPort());
configRefreshTimer = new QTimer(); configRefreshTimer = new QTimer();
connect(configRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshConfig())); connect(configRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshConfig()));
connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newCon())); connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newCon()));
refreshConfig(); refreshConfig();
configRefreshTimer->start(10000); configRefreshTimer->start(10000);
} }
CleanerServer::~CleanerServer() CleanerServer::~CleanerServer()
{ {
delete config; delete config;
delete myMessageFilter; delete myMessageFilter;
delete tcpServer; delete tcpServer;
delete configRefreshTimer; delete configRefreshTimer;
} }
void CleanerServer::newCon() void CleanerServer::newCon()
{ {
if(!blockConnection) { if(!blockConnection) {
tcpSocket = tcpServer->nextPendingConnection(); tcpSocket = tcpServer->nextPendingConnection();
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(onRead())); connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(onRead()));
connect(tcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState))); connect(tcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
blockConnection = true; blockConnection = true;
} }
} }
void CleanerServer::onRead() void CleanerServer::onRead()
{ {
qint64 bytesRead = tcpSocket->read((char *)m_recvBuf + m_recvBufUsed, sizeof(m_recvBuf) - m_recvBufUsed); qint64 bytesRead = tcpSocket->read((char *)m_recvBuf + m_recvBufUsed, sizeof(m_recvBuf) - m_recvBufUsed);
bool error = bytesRead < 1; bool error = bytesRead < 1;
if (!error) if (!error)
{ {
m_recvBufUsed += bytesRead; m_recvBufUsed += bytesRead;
asn_dec_rval_t retVal; asn_dec_rval_t retVal;
do do
{ {
// Try to decode the packets. // Try to decode the packets.
InternalChatCleanerPacket recvMsg; InternalChatCleanerPacket recvMsg;
retVal = ber_decode(0, &asn_DEF_ChatCleanerMessage, (void **)recvMsg.GetMsgPtr(), m_recvBuf, m_recvBufUsed); retVal = ber_decode(0, &asn_DEF_ChatCleanerMessage, (void **)recvMsg.GetMsgPtr(), m_recvBuf, m_recvBufUsed);
if(retVal.code == RC_OK) if(retVal.code == RC_OK)
{ {
if (retVal.consumed < m_recvBufUsed) if (retVal.consumed < m_recvBufUsed)
{ {
m_recvBufUsed -= retVal.consumed; m_recvBufUsed -= retVal.consumed;
memmove(m_recvBuf, m_recvBuf + retVal.consumed, m_recvBufUsed); memmove(m_recvBuf, m_recvBuf + retVal.consumed, m_recvBufUsed);
} }
else else
m_recvBufUsed = 0; m_recvBufUsed = 0;
// Handle the packets. // Handle the packets.
error = handleMessage(recvMsg); error = handleMessage(recvMsg);
} }
} while (!error && retVal.code == RC_OK); } while (!error && retVal.code == RC_OK);
} }
if (error) if (error)
{ {
qDebug() << "Error handling packets from client."; qDebug() << "Error handling packets from client.";
tcpSocket->close(); tcpSocket->close();
} }
/* char buf[1024]; /* char buf[1024];
tcpSocket->readLine(buf, sizeof(buf)); tcpSocket->readLine(buf, sizeof(buf));
QString message = QString::fromUtf8("%1").arg(buf); QString message = QString::fromUtf8("%1").arg(buf);
// TESTING DEFAULT VALUES // TESTING DEFAULT VALUES
QString nick = "PlayerNick"; QString nick = "PlayerNick";
unsigned playerId = 1; unsigned playerId = 1;
// TESTING DEFAULT VALUES // TESTING DEFAULT VALUES
QString checkMessage = myMessageFilter->check(playerId, nick, message); QString checkMessage = myMessageFilter->check(playerId, nick, message);
tcpSocket->write(checkMessage.toAscii().data(), checkMessage.length());*/ tcpSocket->write(checkMessage.toAscii().data(), checkMessage.length());*/
} }
bool CleanerServer::handleMessage(InternalChatCleanerPacket &msg) { bool CleanerServer::handleMessage(InternalChatCleanerPacket &msg) {
bool error = true; bool error = true;
if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerInitMessage) if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerInitMessage)
{ {
CleanerInitMessage_t *netInit = &msg.GetMsg()->choice.cleanerInitMessage; CleanerInitMessage_t *netInit = &msg.GetMsg()->choice.cleanerInitMessage;
if (netInit->requestedVersion == CLEANER_PROTOCOL_VERSION) if (netInit->requestedVersion == CLEANER_PROTOCOL_VERSION)
{ {
string tmpClientSecret((const char *)netInit->clientSecret.buf, netInit->clientSecret.size); string tmpClientSecret((const char *)netInit->clientSecret.buf, netInit->clientSecret.size);
if (clientSecret == QString::fromStdString(tmpClientSecret)) if (clientSecret == QString::fromStdString(tmpClientSecret))
{ {
error = false; error = false;
InternalChatCleanerPacket tmpAck; InternalChatCleanerPacket tmpAck;
tmpAck.GetMsg()->present = ChatCleanerMessage_PR_cleanerInitAckMessage; tmpAck.GetMsg()->present = ChatCleanerMessage_PR_cleanerInitAckMessage;
CleanerInitAckMessage_t *netAck = &tmpAck.GetMsg()->choice.cleanerInitAckMessage; CleanerInitAckMessage_t *netAck = &tmpAck.GetMsg()->choice.cleanerInitAckMessage;
netAck->serverVersion = CLEANER_PROTOCOL_VERSION; netAck->serverVersion = CLEANER_PROTOCOL_VERSION;
string tmpServerSecret(serverSecret.toStdString()); string tmpServerSecret(serverSecret.toStdString());
OCTET_STRING_fromBuf(&netAck->serverSecret, OCTET_STRING_fromBuf(&netAck->serverSecret,
tmpServerSecret.c_str(), tmpServerSecret.c_str(),
tmpServerSecret.length()); tmpServerSecret.length());
sendMessageToClient(tmpAck); sendMessageToClient(tmpAck);
} }
else else
qDebug() << "Invalid client secret."; qDebug() << "Invalid client secret.";
} }
else else
qDebug() << "Invalid client version: " << netInit->requestedVersion; qDebug() << "Invalid client version: " << netInit->requestedVersion;
} }
else if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerChatRequestMessage) else if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerChatRequestMessage)
{ {
error = false; error = false;
CleanerChatRequestMessage_t *netRequest = &msg.GetMsg()->choice.cleanerChatRequestMessage; CleanerChatRequestMessage_t *netRequest = &msg.GetMsg()->choice.cleanerChatRequestMessage;
unsigned playerId = netRequest->playerId; unsigned playerId = netRequest->playerId;
QString nick(QString::fromUtf8( QString nick(QString::fromUtf8(
string((const char *)netRequest->playerName.buf, netRequest->playerName.size).c_str())); string((const char *)netRequest->playerName.buf, netRequest->playerName.size).c_str()));
QString message(QString::fromUtf8( QString message(QString::fromUtf8(
string((const char *)netRequest->chatMessage.buf, netRequest->chatMessage.size).c_str())); string((const char *)netRequest->chatMessage.buf, netRequest->chatMessage.size).c_str()));
QStringList checkreturn = myMessageFilter->check(playerId, nick, message); QStringList checkreturn = myMessageFilter->check(playerId, nick, message);
QString checkAction = checkreturn.at(0); QString checkAction = checkreturn.at(0);
QString checkMessage = checkreturn.at(1); QString checkMessage = checkreturn.at(1);
if (!checkAction.isEmpty()) if (!checkAction.isEmpty())
{ {
InternalChatCleanerPacket tmpReply; InternalChatCleanerPacket tmpReply;
tmpReply.GetMsg()->present = ChatCleanerMessage_PR_cleanerChatReplyMessage; tmpReply.GetMsg()->present = ChatCleanerMessage_PR_cleanerChatReplyMessage;
CleanerChatReplyMessage_t *netReply = &tmpReply.GetMsg()->choice.cleanerChatReplyMessage; CleanerChatReplyMessage_t *netReply = &tmpReply.GetMsg()->choice.cleanerChatReplyMessage;
netReply->requestId = netRequest->requestId; netReply->requestId = netRequest->requestId;
netReply->playerId = netRequest->playerId; netReply->cleanerChatType = netRequest->cleanerChatType;
netReply->playerId = netRequest->playerId;
if(checkAction == "warn") { if(checkAction == "warn") {
netReply->cleanerActionType = cleanerActionType_cleanerActionWarning; netReply->cleanerActionType = cleanerActionType_cleanerActionWarning;
} }
else if(checkAction == "kick") { else if(checkAction == "kick") {
netReply->cleanerActionType = cleanerActionType_cleanerActionKick; netReply->cleanerActionType = cleanerActionType_cleanerActionKick;
} }
else if(checkAction == "kickban") { else if(checkAction == "kickban") {
netReply->cleanerActionType = cleanerActionType_cleanerActionBan; netReply->cleanerActionType = cleanerActionType_cleanerActionBan;
} }
string tmpCheck(checkMessage.toUtf8()); string tmpCheck(checkMessage.toUtf8());
netReply->cleanerText = netReply->cleanerText =
OCTET_STRING_new_fromBuf( OCTET_STRING_new_fromBuf(
&asn_DEF_OCTET_STRING, &asn_DEF_OCTET_STRING,
(const char *)tmpCheck.c_str(), (const char *)tmpCheck.c_str(),
tmpCheck.length()); tmpCheck.length());
sendMessageToClient(tmpReply); sendMessageToClient(tmpReply);
} }
} }
return error; return error;
} }
void CleanerServer::socketStateChanged(QAbstractSocket::SocketState state) { void CleanerServer::socketStateChanged(QAbstractSocket::SocketState state) {
qDebug() << "Socket state changed to: " << QAbstractSocket::UnconnectedState; qDebug() << "Socket state changed to: " << QAbstractSocket::UnconnectedState;
if(state == QAbstractSocket::UnconnectedState) blockConnection = false; if(state == QAbstractSocket::UnconnectedState) blockConnection = false;
} }
void CleanerServer::refreshConfig() { void CleanerServer::refreshConfig() {
QFileInfo configFileInfo(QString::fromUtf8(config->getConfigFileName().c_str())); QFileInfo configFileInfo(QString::fromUtf8(config->getConfigFileName().c_str()));
if(configFileInfo.lastModified().secsTo(QDateTime::currentDateTime()) < 20) { if(configFileInfo.lastModified().secsTo(QDateTime::currentDateTime()) < 20) {
config->fillBuffer(); config->fillBuffer();
} }
myMessageFilter->refreshConfig(); myMessageFilter->refreshConfig();
} }
void CleanerServer::sendMessageToClient(InternalChatCleanerPacket &msg) void CleanerServer::sendMessageToClient(InternalChatCleanerPacket &msg)
{ {
unsigned char buf[MAX_CLEANER_PACKET_SIZE]; unsigned char buf[MAX_CLEANER_PACKET_SIZE];
asn_enc_rval_t e = der_encode_to_buffer(&asn_DEF_ChatCleanerMessage, msg.GetMsg(), buf, MAX_CLEANER_PACKET_SIZE); asn_enc_rval_t e = der_encode_to_buffer(&asn_DEF_ChatCleanerMessage, msg.GetMsg(), buf, MAX_CLEANER_PACKET_SIZE);
if (e.encoded == -1) if (e.encoded == -1)
qDebug() << "Failed to encode chat cleaner packet: " << msg.GetMsg()->present; qDebug() << "Failed to encode chat cleaner packet: " << msg.GetMsg()->present;
else else
tcpSocket->write((const char *)buf, e.encoded); tcpSocket->write((const char *)buf, e.encoded);
} }
+1
View File
@@ -30,6 +30,7 @@ public:
virtual ~ChatCleanerCallback(); virtual ~ChatCleanerCallback();
virtual void SignalChatBotMessage(const std::string &msg) = 0; virtual void SignalChatBotMessage(const std::string &msg) = 0;
virtual void SignalChatBotMessage(unsigned gameId, const std::string &msg) = 0;
virtual void SignalKickPlayer(unsigned playerId) = 0; virtual void SignalKickPlayer(unsigned playerId) = 0;
virtual void SignalBanPlayer(unsigned playerId) = 0; virtual void SignalBanPlayer(unsigned playerId) = 0;
}; };
+2 -1
View File
@@ -38,7 +38,8 @@ public:
void Init(const std::string &serverAddr, int port, bool ipv6, void Init(const std::string &serverAddr, int port, bool ipv6,
const std::string &clientSecret, const std::string &serverSecret); const std::string &clientSecret, const std::string &serverSecret);
void ReInit(); void ReInit();
void HandleChatText(unsigned playerId, const std::string &name, const std::string &text); void HandleLobbyChatText(unsigned playerId, const std::string &name, const std::string &text);
void HandleGameChatText(unsigned gameId, unsigned playerId, const std::string &name, const std::string &text);
protected: protected:
+28 -2
View File
@@ -74,7 +74,13 @@ ChatCleanerManager::ReInit()
} }
void void
ChatCleanerManager::HandleChatText(unsigned playerId, const std::string &name, const std::string &text) ChatCleanerManager::HandleLobbyChatText(unsigned playerId, const std::string &name, const std::string &text)
{
HandleGameChatText(0, playerId, name, text);
}
void
ChatCleanerManager::HandleGameChatText(unsigned gameId, unsigned playerId, const std::string &name, const std::string &text)
{ {
if (m_connected) if (m_connected)
{ {
@@ -82,6 +88,15 @@ ChatCleanerManager::HandleChatText(unsigned playerId, const std::string &name, c
tmpChat.GetMsg()->present = ChatCleanerMessage_PR_cleanerChatRequestMessage; tmpChat.GetMsg()->present = ChatCleanerMessage_PR_cleanerChatRequestMessage;
CleanerChatRequestMessage_t *netRequest = &tmpChat.GetMsg()->choice.cleanerChatRequestMessage; CleanerChatRequestMessage_t *netRequest = &tmpChat.GetMsg()->choice.cleanerChatRequestMessage;
netRequest->requestId = GetNextRequestId(); netRequest->requestId = GetNextRequestId();
if (gameId)
{
netRequest->cleanerChatType.present = CleanerChatType_PR_cleanerChatTypeGame;
netRequest->cleanerChatType.choice.cleanerChatTypeGame.gameId = gameId;
}
else
{
netRequest->cleanerChatType.present = CleanerChatType_PR_cleanerChatTypeLobby;
}
netRequest->playerId = playerId; netRequest->playerId = playerId;
OCTET_STRING_fromBuf(&netRequest->playerName, OCTET_STRING_fromBuf(&netRequest->playerName,
name.c_str(), name.c_str(),
@@ -252,7 +267,16 @@ ChatCleanerManager::HandleMessage(InternalChatCleanerPacket &msg)
{ {
CleanerChatReplyMessage_t *netReply = &msg.GetMsg()->choice.cleanerChatReplyMessage; CleanerChatReplyMessage_t *netReply = &msg.GetMsg()->choice.cleanerChatReplyMessage;
if (netReply->cleanerText) if (netReply->cleanerText)
m_callback.SignalChatBotMessage(string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size)); {
if (netReply->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeLobby)
{
m_callback.SignalChatBotMessage(string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size));
}
else if (netReply->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeGame)
{
m_callback.SignalChatBotMessage(netReply->cleanerChatType.choice.cleanerChatTypeGame.gameId, string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size));
}
}
if (netReply->cleanerActionType == cleanerActionType_cleanerActionKick) if (netReply->cleanerActionType == cleanerActionType_cleanerActionKick)
m_callback.SignalKickPlayer(netReply->playerId); m_callback.SignalKickPlayer(netReply->playerId);
else if (netReply->cleanerActionType == cleanerActionType_cleanerActionBan) else if (netReply->cleanerActionType == cleanerActionType_cleanerActionBan)
@@ -273,6 +297,8 @@ ChatCleanerManager::SendMessageToServer(InternalChatCleanerPacket &msg)
else else
{ {
boost::shared_ptr<EncodedPacket> tmpPacket(new EncodedPacket(buf, e.encoded)); boost::shared_ptr<EncodedPacket> tmpPacket(new EncodedPacket(buf, e.encoded));
// Actually, this should not be done (parallel async_write calls might break data).
// But we do not want to create additional buffers here.
boost::asio::async_write( boost::asio::async_write(
*m_socket, *m_socket,
boost::asio::buffer(tmpPacket->GetData(), tmpPacket->GetSize()), boost::asio::buffer(tmpPacket->GetData(), tmpPacket->GetSize()),
+1
View File
@@ -767,6 +767,7 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
} }
else if (netMessage->chatType.present == chatType_PR_chatTypeBot) else if (netMessage->chatType.present == chatType_PR_chatTypeBot)
{ {
client->GetCallback().SignalNetClientGameChatMsg("(chat bot)", STL_STRING_FROM_OCTET_STRING(netMessage->chatText));
client->GetCallback().SignalNetClientLobbyChatMsg("(chat bot)", STL_STRING_FROM_OCTET_STRING(netMessage->chatText)); client->GetCallback().SignalNetClientLobbyChatMsg("(chat bot)", STL_STRING_FROM_OCTET_STRING(netMessage->chatText));
} }
else if (netMessage->chatType.present == chatType_PR_chatTypeGame) else if (netMessage->chatType.present == chatType_PR_chatTypeGame)
+11
View File
@@ -26,6 +26,7 @@
#include <net/socket_msg.h> #include <net/socket_msg.h>
#include <net/serverexception.h> #include <net/serverexception.h>
#include <net/net_helper.h> #include <net/net_helper.h>
#include <net/chatcleanermanager.h>
#include <db/serverdbinterface.h> #include <db/serverdbinterface.h>
#include <core/loghelper.h> #include <core/loghelper.h>
#include <core/avatarmanager.h> #include <core/avatarmanager.h>
@@ -291,6 +292,16 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
(char *)netChatRequest->chatText.buf, (char *)netChatRequest->chatText.buf,
netChatRequest->chatText.size); netChatRequest->chatText.size);
server->SendToAllPlayers(packet, SessionData::Game); server->SendToAllPlayers(packet, SessionData::Game);
// Send the message to the chat cleaner bot for ranking games.
//if (server->GetGameData().gameType == GAME_TYPE_RANKING)
//{
server->GetLobbyThread().GetChatCleaner().HandleGameChatText(
server->GetId(),
session.playerData->GetUniqueId(),
session.playerData->GetName(),
string((char *)netChatRequest->chatText.buf, netChatRequest->chatText.size));
//}
} }
} }
} }
+32 -1
View File
@@ -103,6 +103,11 @@ public:
m_server.SendChatBotMsg(msg); m_server.SendChatBotMsg(msg);
} }
virtual void SignalChatBotMessage(unsigned gameId, const std::string &msg)
{
m_server.SendChatBotMsg(gameId, msg);
}
virtual void SignalKickPlayer(unsigned playerId) virtual void SignalKickPlayer(unsigned playerId)
{ {
m_server.RemovePlayer(playerId, ERR_NET_PLAYER_KICKED); m_server.RemovePlayer(playerId, ERR_NET_PLAYER_KICKED);
@@ -611,6 +616,25 @@ ServerLobbyThread::SendChatBotMsg(const std::string &message)
message); message);
} }
void
ServerLobbyThread::SendChatBotMsg(unsigned gameId, const std::string &message)
{
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
packet->GetMsg()->present = PokerTHMessage_PR_chatMessage;
ChatMessage_t *netChat = &packet->GetMsg()->choice.chatMessage;
netChat->chatType.present = chatType_PR_chatTypeBot;
OCTET_STRING_fromBuf(
&netChat->chatText,
message.c_str(),
message.length());
GameMap::const_iterator pos = m_gameMap.find(gameId);
if (pos != m_gameMap.end())
{
pos->second->SendToAllPlayers(packet, SessionData::Game);
}
}
void void
ServerLobbyThread::ReconnectChatBot() ServerLobbyThread::ReconnectChatBot()
{ {
@@ -650,6 +674,13 @@ ServerLobbyThread::GetAvatarManager()
return m_avatarManager; return m_avatarManager;
} }
ChatCleanerManager &
ServerLobbyThread::GetChatCleaner()
{
assert(m_chatCleanerManager);
return *m_chatCleanerManager;
}
ServerStats ServerStats
ServerLobbyThread::GetStats() const ServerLobbyThread::GetStats() const
{ {
@@ -1466,7 +1497,7 @@ ServerLobbyThread::HandleNetPacketChatRequest(SessionWrapper session, const Chat
string chatMsg = STL_STRING_FROM_OCTET_STRING(chatRequest.chatText); string chatMsg = STL_STRING_FROM_OCTET_STRING(chatRequest.chatText);
// Send the message to the chat cleaner bot. // Send the message to the chat cleaner bot.
m_chatCleanerManager->HandleChatText( m_chatCleanerManager->HandleLobbyChatText(
session.playerData->GetUniqueId(), session.playerData->GetUniqueId(),
session.playerData->GetName(), session.playerData->GetName(),
chatMsg); chatMsg);
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef _INTERNALCHATCLEANERPACKET_H_ #ifndef _INTERNALCHATCLEANERPACKET_H_
#define _INTERNALCHATCLEANERPACKET_H_ #define _INTERNALCHATCLEANERPACKET_H_
#define CLEANER_PROTOCOL_VERSION 1 #define CLEANER_PROTOCOL_VERSION 2
#define MAX_CLEANER_PACKET_SIZE 384 #define MAX_CLEANER_PACKET_SIZE 384
typedef struct ChatCleanerMessage ChatCleanerMessage_t; typedef struct ChatCleanerMessage ChatCleanerMessage_t;
+2 -1
View File
@@ -83,10 +83,10 @@ public:
std::string GetPlayerNameFromId(unsigned playerId) const; std::string GetPlayerNameFromId(unsigned playerId) const;
void RemovePlayer(unsigned playerId, unsigned errorCode); void RemovePlayer(unsigned playerId, unsigned errorCode);
void SendGlobalChat(const std::string &message); void SendGlobalChat(const std::string &message);
void SendGlobalMsgBox(const std::string &message); void SendGlobalMsgBox(const std::string &message);
void SendChatBotMsg(const std::string &message); void SendChatBotMsg(const std::string &message);
void SendChatBotMsg(unsigned gameId, const std::string &message);
void ReconnectChatBot(); void ReconnectChatBot();
void AddComputerPlayer(boost::shared_ptr<PlayerData> player); void AddComputerPlayer(boost::shared_ptr<PlayerData> player);
@@ -101,6 +101,7 @@ public:
void SetGameDBId(u_int32_t gameId, DB_id gameDBId); void SetGameDBId(u_int32_t gameId, DB_id gameDBId);
AvatarManager &GetAvatarManager(); AvatarManager &GetAvatarManager();
ChatCleanerManager &GetChatCleaner();
ServerStats GetStats() const; ServerStats GetStats() const;
boost::posix_time::ptime GetStartTime() const; boost::posix_time::ptime GetStartTime() const;