diff --git a/src/net/chatcleanercallback.h b/src/net/chatcleanercallback.h index e116cc9a..d888e18f 100644 --- a/src/net/chatcleanercallback.h +++ b/src/net/chatcleanercallback.h @@ -30,6 +30,8 @@ public: virtual ~ChatCleanerCallback(); virtual void SignalChatBotMessage(const std::string &msg) = 0; + virtual void SignalKickPlayer(unsigned playerId) = 0; + virtual void SignalBanPlayer(unsigned playerId) = 0; }; #endif diff --git a/src/net/common/chatcleanermanager.cpp b/src/net/common/chatcleanermanager.cpp index dc71fe75..e74535ed 100644 --- a/src/net/common/chatcleanermanager.cpp +++ b/src/net/common/chatcleanermanager.cpp @@ -250,7 +250,12 @@ ChatCleanerManager::HandleMessage(InternalChatCleanerPacket &msg) else if (msg.GetMsg()->present == ChatCleanerMessage_PR_cleanerChatReplyMessage) { CleanerChatReplyMessage_t *netReply = &msg.GetMsg()->choice.cleanerChatReplyMessage; - m_callback.SignalChatBotMessage(string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size)); + if (netReply->cleanerText) + m_callback.SignalChatBotMessage(string((const char *)netReply->cleanerText->buf, netReply->cleanerText->size)); + if (netReply->cleanerActionType == cleanerActionType_cleanerActionKick) + m_callback.SignalKickPlayer(netReply->playerId); + else if (netReply->cleanerActionType == cleanerActionType_cleanerActionBan) + m_callback.SignalBanPlayer(netReply->playerId); error = false; } return error; diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index bd43dd40..4581aa1a 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -93,11 +93,22 @@ public: { m_server.GetSender().SignalSessionTerminated(session); } + virtual void SignalChatBotMessage(const string &msg) { m_server.SendChatBotMsg(msg); } + virtual void SignalKickPlayer(unsigned playerId) + { + m_server.RemovePlayer(playerId, ERR_NET_PLAYER_KICKED); + } + + virtual void SignalBanPlayer(unsigned playerId) + { + // TODO + } + virtual void ConnectSuccess() { LOG_MSG("Successfully connected to database.");