Example #1
0
void ChatLog::_Initialize()
{
    // Load config settings
    _enable = ConfigMgr::GetBoolDefault("ChatLog.Enable", true);
    _dateSplit = ConfigMgr::GetBoolDefault("ChatLog.DateSplit", true);
    _utfHeader = ConfigMgr::GetBoolDefault("ChatLog.UTFHeader", true);
    _ignoreUnprintable = ConfigMgr::GetBoolDefault("ChatLog.Ignore.Unprintable", true);
    _flushLength = ConfigMgr::GetIntDefault("ChatLog.FlushAfterNumberOfBytes", 1024); // 1 kB

    _lexicsEnable = ConfigMgr::GetBoolDefault("ChatLog.Lexics.Enable", true);
    if (_lexicsEnable)
    {
        std::string analogsFileName = ConfigMgr::GetStringDefault("ChatLog.Lexics.AnalogsFile", "");
        std::string innormativeWordsFileName = ConfigMgr::GetStringDefault("ChatLog.Lexics.WordsFile", "");

        _innormativeLog = new ChatLogInfo(CHAT_LOG_INNORMATIVE, true, false, 0);
        if (analogsFileName.empty() || innormativeWordsFileName.empty())
            _lexicsEnable = false;
        else
        {
            // Initialize lexics cutter parameters
            _lexicsInnormativeCut = ConfigMgr::GetBoolDefault("ChatLog.Lexics.Cut.Enable", true);
            _lexicsCutReplacement = ConfigMgr::GetStringDefault("ChatLog.Lexics.Cut.Replacement", "&!@^%!^&*!!!");
            _lexicsAction = LexicsActions(ConfigMgr::GetIntDefault("ChatLog.Lexics.Action", LEXICS_ACTION_LOG));
            _lexicsActionDuration = ConfigMgr::GetIntDefault("ChatLog.Lexics.Action.Duration", 0);

            // Initialize lexics cutter object
            _lexics = new LexicsCutter(analogsFileName, innormativeWordsFileName,
                ConfigMgr::GetBoolDefault("ChatLog.Lexics.Ignore.Spaces", true),
                ConfigMgr::GetBoolDefault("ChatLog.Lexics.Ignore.Repeats", true));

            // Read additional parameters
            _lexicsIgnoreGm = ConfigMgr::GetBoolDefault("ChatLog.Lexics.Ignore.GM", true);
        }
    }

    for (uint32 i = CHAT_LOG_CHAT; i < CHAT_LOG_COUNT; ++i)
        _logs[i] = new ChatLogInfo(ChatLogType(i), _enable, _lexicsEnable, _flushLength);

    _OpenAllFiles();
}
Example #2
0
void ChatLog::_Initialize()
{
    // Load config settings
    _enable = sConfig->GetBoolDefault("ChatLog.Enable", true);
    _ignoreUnprintable = sConfig->GetBoolDefault("ChatLog.Ignore.Unprintable", true);

    _lexicsEnable = sConfig->GetBoolDefault("ChatLog.Lexics.Enable", true);
    if (_lexicsEnable)
    {
        std::string analogsFileName = sConfig->GetStringDefault("ChatLog.Lexics.AnalogsFile", "");
        std::string innormativeWordsFileName = sConfig->GetStringDefault("ChatLog.Lexics.WordsFile", "");

        _innormativeLog = new ChatLogInfo(CHAT_LOG_INNORMATIVE, true, false);
        if (analogsFileName.empty() || innormativeWordsFileName.empty())
            _lexicsEnable = false;
        else
        {
            // Initialize lexics cutter parameters
            _lexicsInnormativeCut = sConfig->GetBoolDefault("ChatLog.Lexics.Cut.Enable", true);
            _lexicsCutReplacement = sConfig->GetStringDefault("ChatLog.Lexics.Cut.Replacement", "&!@^%!^&*!!!");
            _lexicsAction = LexicsActions(sConfig->GetIntDefault("ChatLog.Lexics.Action", LEXICS_ACTION_LOG));
            _lexicsActionDuration = sConfig->GetIntDefault("ChatLog.Lexics.Action.Duration", 0);

            // Initialize lexics cutter object
            _lexics = new LexicsCutter(analogsFileName, innormativeWordsFileName,
                sConfig->GetBoolDefault("ChatLog.Lexics.Ignore.Spaces", true),
                sConfig->GetBoolDefault("ChatLog.Lexics.Ignore.Repeats", true));

            // Read additional parameters
            _lexicsIgnoreGm = sConfig->GetBoolDefault("ChatLog.Lexics.Ignore.GM", true);
        }
    }

    for (uint32 i = CHAT_LOG_CHAT; i < CHAT_LOG_COUNT; ++i)
        _logs[i] = new ChatLogInfo(ChatLogType(i), _enable, _lexicsEnable);
}