Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
- index 8812701..ca3da21 100644
- --- a/src/game/MiscHandler.cpp
- +++ b/src/game/MiscHandler.cpp
- @@ -1336,7 +1336,10 @@ void WorldSession::HandleReportSpamOpcode( WorldPacket & recv_data )
- data << uint8(0);
- SendPacket(&data);
- - sLog.outDebug("REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str());
- + std::string spamer_name;
- + objmgr.GetPlayerNameByGUID(spammer_guid, spamer_name);
- +
- + sLog.outSpam("Spamer: %s (Guid %u) , Message : %s , Reporter : %s", spamer_name.c_str() ,GUID_LOPART(spammer_guid) , description.c_str(), GetPlayerName());
- }
- void WorldSession::HandleRealmStateRequestOpcode( WorldPacket & recv_data )
- diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
- index 2c6ca91..c708457 100644
- --- a/src/mangosd/mangosd.conf.dist.in
- +++ b/src/mangosd/mangosd.conf.dist.in
- @@ -251,6 +251,10 @@ AddonChannel = 1
- # Default: 0 - don't include dumping chars to log
- # 1 - include dumping chars to log
- #
- +# SpamLogFile
- +# Spam Log file for logging player reported spams
- +# Default: "" (disabled)
- +#
- # GmLogFile
- # GM Log file of gm commands
- # Default: "" (Disable)
- @@ -296,6 +300,7 @@ DBErrorLogFile = "DBErrors.log"
- CharLogFile = "Char.log"
- CharLogTimestamp = 0
- CharLogDump = 0
- +SpamlogFile = "spam.log"
- GmLogFile = ""
- GmLogTimestamp = 0
- GmLogPerAccount = 0
- diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp
- index f5d0513..45c0e1a 100644
- --- a/src/shared/Log.cpp
- +++ b/src/shared/Log.cpp
- @@ -37,7 +37,7 @@ enum LogType
- const int LogType_count = int(LogError) +1;
- Log::Log() :
- - raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
- + raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), spamlog(NULL),
- dberLogfile(NULL), m_colored(false), m_includeTime(false), m_gmlog_per_account(false)
- {
- Initialize();
- @@ -228,6 +228,7 @@ void Log::Initialize()
- dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
- raLogfile = openLogFile("RaLogFile",NULL,"a");
- + spamlog = openLogFile("SpamlogFile", NULL, "a");
- // Main log file settings
- m_includeTime = sConfig.GetBoolDefault("LogTime", false);
- @@ -725,6 +726,38 @@ void Log::outRALog( const char * str, ... )
- fflush(stdout);
- }
- +void Log::outSpam( const char * msg, ... )
- +{
- + if( !msg ) return;
- +
- + if(m_colored)
- + SetColor(false,m_colors[LogError]);
- +
- + if(m_includeTime)
- + outTime();
- +
- + va_list ap;
- + va_start(ap, msg);
- + vfprintf( stderr, msg, ap );
- + va_end(ap);
- +
- + if(m_colored)
- + ResetColor(false);
- +
- + fprintf( stderr, "\n" );
- + if(spamlog)
- + {
- + outTimestamp(spamlog);
- + fprintf(spamlog, "Reported spam:" );
- + va_start(ap, msg);
- + vfprintf(spamlog, msg, ap);
- + fprintf(spamlog, "\n" );
- + va_end(ap);
- + fflush(spamlog);
- + }
- + fflush(stderr);
- +}
- +
- void outstring_log(const char * str, ...)
- {
- if( !str )
- diff --git a/src/shared/Log.h b/src/shared/Log.h
- index 391a93d..bc071e2 100644
- --- a/src/shared/Log.h
- +++ b/src/shared/Log.h
- @@ -79,6 +79,11 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
- if (raLogfile != NULL)
- fclose(raLogfile);
- raLogfile = NULL;
- +
- + if (spamlog != NULL)
- + fclose(spamlog);
- + raLogfile = NULL;
- +
- }
- public:
- void Initialize();
- @@ -107,6 +112,8 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
- // any log level
- void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name );
- void outRALog( const char * str, ... ) ATTR_PRINTF(2,3);
- + void outSpam( const char * msg, ... ) ATTR_PRINTF(2,3);
- +
- void SetLogLevel(char * Level);
- void SetLogFileLevel(char * Level);
- void SetColor(bool stdout_stream, Color color);
- @@ -123,6 +130,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
- FILE* openGmlogPerAccount(uint32 account);
- FILE* raLogfile;
- + FILE* spamlog;
- FILE* logfile;
- FILE* gmLogfile;
- FILE* charLogfile;
Advertisement
Add Comment
Please, Sign In to add comment