diff --git a/src/chatcleaner/cleanerconfig.cpp b/src/chatcleaner/cleanerconfig.cpp index 5d8cf3da..50d78575 100644 --- a/src/chatcleaner/cleanerconfig.cpp +++ b/src/chatcleaner/cleanerconfig.cpp @@ -43,7 +43,7 @@ using namespace std; CleanerConfig::CleanerConfig() { // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 6; + configRev = 7; // Pfad und Dateinamen setzen #ifdef _WIN32 @@ -112,10 +112,10 @@ CleanerConfig::CleanerConfig() configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str())); 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("ExpectedAuthString", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("AuthAnswerString", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ClientAuthString", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ServerAuthString", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("WarnLevelToKick", CONFIG_TYPE_INT, "2")); configList.push_back(ConfigInfo("TextFloodLevelToTrigger", CONFIG_TYPE_INT, "3")); diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index d9d6a0c0..d1d10117 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -222,11 +222,11 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("AdminIRCChannelPassword", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("AdminIRCServerUseIpv6", CONFIG_TYPE_INT, "0")); 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("ChatCleanerPort", CONFIG_TYPE_INT, "4237")); - configList.push_back(ConfigInfo("ChatCleanerAuthString", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("ChatCleanerExpectedAuthAnswer", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ChatCleanerClientAuth", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ChatCleanerServerAuth", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("ChatCleanerUseIpv6", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player")); configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, "")); diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 858eae9d..24facd4a 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -25,9 +25,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -101,6 +103,7 @@ ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ConfigFile *playerConfig m_sender.reset(new SenderHelper(*m_senderCallback, m_ioService)); m_receiver.reset(new ReceiverHelper); m_banManager.reset(new ServerBanManager(m_ioService)); + m_chatCleanerManager.reset(new ChatCleanerManager(m_ioService)); } ServerLobbyThread::~ServerLobbyThread() @@ -499,6 +502,7 @@ ServerLobbyThread::GetNextGameId() void ServerLobbyThread::Main() { + InitChatCleaner(); // Register all timers. RegisterTimers(); try @@ -570,6 +574,20 @@ ServerLobbyThread::CancelTimers() 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 ServerLobbyThread::HandleRead(const boost::system::error_code &ec, SessionId sessionId, size_t bytesRead) { diff --git a/src/net/serverlobbythread.h b/src/net/serverlobbythread.h index 7c637d54..8fbeb794 100644 --- a/src/net/serverlobbythread.h +++ b/src/net/serverlobbythread.h @@ -42,6 +42,7 @@ class ServerGame; class ServerBanManager; class ConfigFile; class AvatarManager; +class ChatCleanerManager; struct GameData; class Game; @@ -108,6 +109,7 @@ protected: virtual void Main(); void RegisterTimers(); void CancelTimers(); + void InitChatCleaner(); void HandleRead(const boost::system::error_code &ec, SessionId sessionId, size_t bytesRead); void HandlePacket(SessionWrapper session, boost::shared_ptr packet); @@ -204,6 +206,7 @@ private: mutable boost::mutex m_statMutex; boost::shared_ptr m_banManager; + boost::shared_ptr m_chatCleanerManager; boost::asio::deadline_timer m_removeGameTimer; boost::asio::deadline_timer m_removePlayerTimer;