Integrating chat cleaner manager in lobby.
This commit is contained in:
@@ -43,7 +43,7 @@ using namespace std;
|
|||||||
CleanerConfig::CleanerConfig()
|
CleanerConfig::CleanerConfig()
|
||||||
{
|
{
|
||||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||||
configRev = 6;
|
configRev = 7;
|
||||||
|
|
||||||
// Pfad und Dateinamen setzen
|
// Pfad und Dateinamen setzen
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -112,10 +112,10 @@ CleanerConfig::CleanerConfig()
|
|||||||
configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str()));
|
configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str()));
|
||||||
configList.push_back(ConfigInfo("Language", CONFIG_TYPE_STRING, getDefaultLanguage()));
|
configList.push_back(ConfigInfo("Language", CONFIG_TYPE_STRING, getDefaultLanguage()));
|
||||||
|
|
||||||
configList.push_back(ConfigInfo("HostAddress", CONFIG_TYPE_STRING, "127.0.0.1"));
|
configList.push_back(ConfigInfo("HostAddress", CONFIG_TYPE_STRING, "0.0.0.0"));
|
||||||
configList.push_back(ConfigInfo("DefaultListenPort", CONFIG_TYPE_STRING, "4327"));
|
configList.push_back(ConfigInfo("DefaultListenPort", CONFIG_TYPE_STRING, "4327"));
|
||||||
configList.push_back(ConfigInfo("ExpectedAuthString", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("ClientAuthString", CONFIG_TYPE_STRING, ""));
|
||||||
configList.push_back(ConfigInfo("AuthAnswerString", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("ServerAuthString", CONFIG_TYPE_STRING, ""));
|
||||||
|
|
||||||
configList.push_back(ConfigInfo("WarnLevelToKick", CONFIG_TYPE_INT, "2"));
|
configList.push_back(ConfigInfo("WarnLevelToKick", CONFIG_TYPE_INT, "2"));
|
||||||
configList.push_back(ConfigInfo("TextFloodLevelToTrigger", CONFIG_TYPE_INT, "3"));
|
configList.push_back(ConfigInfo("TextFloodLevelToTrigger", CONFIG_TYPE_INT, "3"));
|
||||||
|
|||||||
@@ -222,11 +222,11 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
|||||||
configList.push_back(ConfigInfo("AdminIRCChannelPassword", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("AdminIRCChannelPassword", CONFIG_TYPE_STRING, ""));
|
||||||
configList.push_back(ConfigInfo("AdminIRCServerUseIpv6", CONFIG_TYPE_INT, "0"));
|
configList.push_back(ConfigInfo("AdminIRCServerUseIpv6", CONFIG_TYPE_INT, "0"));
|
||||||
configList.push_back(ConfigInfo("AdminIRCServerNick", CONFIG_TYPE_INT, "PokerTH"));
|
configList.push_back(ConfigInfo("AdminIRCServerNick", CONFIG_TYPE_INT, "PokerTH"));
|
||||||
configList.push_back(ConfigInfo("UseChatCleaner", CONFIG_TYPE_INT, "1"));
|
configList.push_back(ConfigInfo("UseChatCleaner", CONFIG_TYPE_INT, "0"));
|
||||||
configList.push_back(ConfigInfo("ChatCleanerHostAddress", CONFIG_TYPE_STRING, "localhost"));
|
configList.push_back(ConfigInfo("ChatCleanerHostAddress", CONFIG_TYPE_STRING, "localhost"));
|
||||||
configList.push_back(ConfigInfo("ChatCleanerPort", CONFIG_TYPE_INT, "4237"));
|
configList.push_back(ConfigInfo("ChatCleanerPort", CONFIG_TYPE_INT, "4237"));
|
||||||
configList.push_back(ConfigInfo("ChatCleanerAuthString", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("ChatCleanerClientAuth", CONFIG_TYPE_STRING, ""));
|
||||||
configList.push_back(ConfigInfo("ChatCleanerExpectedAuthAnswer", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("ChatCleanerServerAuth", CONFIG_TYPE_STRING, ""));
|
||||||
configList.push_back(ConfigInfo("ChatCleanerUseIpv6", CONFIG_TYPE_INT, "0"));
|
configList.push_back(ConfigInfo("ChatCleanerUseIpv6", CONFIG_TYPE_INT, "0"));
|
||||||
configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player"));
|
configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player"));
|
||||||
configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, ""));
|
||||||
|
|||||||
@@ -25,9 +25,11 @@
|
|||||||
#include <net/sendercallback.h>
|
#include <net/sendercallback.h>
|
||||||
#include <net/receiverhelper.h>
|
#include <net/receiverhelper.h>
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
|
#include <net/chatcleanermanager.h>
|
||||||
#include <core/avatarmanager.h>
|
#include <core/avatarmanager.h>
|
||||||
#include <core/loghelper.h>
|
#include <core/loghelper.h>
|
||||||
#include <core/openssl_wrapper.h>
|
#include <core/openssl_wrapper.h>
|
||||||
|
#include <configfile.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -101,6 +103,7 @@ ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ConfigFile *playerConfig
|
|||||||
m_sender.reset(new SenderHelper(*m_senderCallback, m_ioService));
|
m_sender.reset(new SenderHelper(*m_senderCallback, m_ioService));
|
||||||
m_receiver.reset(new ReceiverHelper);
|
m_receiver.reset(new ReceiverHelper);
|
||||||
m_banManager.reset(new ServerBanManager(m_ioService));
|
m_banManager.reset(new ServerBanManager(m_ioService));
|
||||||
|
m_chatCleanerManager.reset(new ChatCleanerManager(m_ioService));
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerLobbyThread::~ServerLobbyThread()
|
ServerLobbyThread::~ServerLobbyThread()
|
||||||
@@ -499,6 +502,7 @@ ServerLobbyThread::GetNextGameId()
|
|||||||
void
|
void
|
||||||
ServerLobbyThread::Main()
|
ServerLobbyThread::Main()
|
||||||
{
|
{
|
||||||
|
InitChatCleaner();
|
||||||
// Register all timers.
|
// Register all timers.
|
||||||
RegisterTimers();
|
RegisterTimers();
|
||||||
try
|
try
|
||||||
@@ -570,6 +574,20 @@ ServerLobbyThread::CancelTimers()
|
|||||||
m_avatarLockTimer.cancel();
|
m_avatarLockTimer.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerLobbyThread::InitChatCleaner()
|
||||||
|
{
|
||||||
|
if (m_playerConfig->readConfigInt("UseChatCleaner") != 0)
|
||||||
|
{
|
||||||
|
m_chatCleanerManager->Init(
|
||||||
|
m_playerConfig->readConfigString("ChatCleanerHostAddress"),
|
||||||
|
m_playerConfig->readConfigInt("ChatCleanerPort"),
|
||||||
|
m_playerConfig->readConfigInt("ChatCleanerUseIpv6") != 0,
|
||||||
|
m_playerConfig->readConfigString("ChatCleanerClientAuth"),
|
||||||
|
m_playerConfig->readConfigString("ChatCleanerServerAuth"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerLobbyThread::HandleRead(const boost::system::error_code &ec, SessionId sessionId, size_t bytesRead)
|
ServerLobbyThread::HandleRead(const boost::system::error_code &ec, SessionId sessionId, size_t bytesRead)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class ServerGame;
|
|||||||
class ServerBanManager;
|
class ServerBanManager;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
class AvatarManager;
|
class AvatarManager;
|
||||||
|
class ChatCleanerManager;
|
||||||
struct GameData;
|
struct GameData;
|
||||||
class Game;
|
class Game;
|
||||||
|
|
||||||
@@ -108,6 +109,7 @@ protected:
|
|||||||
virtual void Main();
|
virtual void Main();
|
||||||
void RegisterTimers();
|
void RegisterTimers();
|
||||||
void CancelTimers();
|
void CancelTimers();
|
||||||
|
void InitChatCleaner();
|
||||||
|
|
||||||
void HandleRead(const boost::system::error_code &ec, SessionId sessionId, size_t bytesRead);
|
void HandleRead(const boost::system::error_code &ec, SessionId sessionId, size_t bytesRead);
|
||||||
void HandlePacket(SessionWrapper session, boost::shared_ptr<NetPacket> packet);
|
void HandlePacket(SessionWrapper session, boost::shared_ptr<NetPacket> packet);
|
||||||
@@ -204,6 +206,7 @@ private:
|
|||||||
mutable boost::mutex m_statMutex;
|
mutable boost::mutex m_statMutex;
|
||||||
|
|
||||||
boost::shared_ptr<ServerBanManager> m_banManager;
|
boost::shared_ptr<ServerBanManager> m_banManager;
|
||||||
|
boost::shared_ptr<ChatCleanerManager> m_chatCleanerManager;
|
||||||
|
|
||||||
boost::asio::deadline_timer m_removeGameTimer;
|
boost::asio::deadline_timer m_removeGameTimer;
|
||||||
boost::asio::deadline_timer m_removePlayerTimer;
|
boost::asio::deadline_timer m_removePlayerTimer;
|
||||||
|
|||||||
Reference in New Issue
Block a user