aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXTZGZoReX <none@none>2009-03-25 14:25:15 +0100
committerXTZGZoReX <none@none>2009-03-25 14:25:15 +0100
commit82e966e5f2862f30e1a661c4fe2e09f5525c4a96 (patch)
treec394ead852cb20d4a3753fa5323de16a32090836
parent833eaa9ed38e822e4704738fe583aebcbbaa6df6 (diff)
* Added support for logging chats: Guild, raid, party, public, officer chat, addon messages, whispers, system/custom channels.
* Added config options to enable/disable them (ChatLogs.*), LogDB.Chat (enables/disables DB logging of chats), and ChatLogFile to specify the log file to use. --HG-- branch : trunk
-rw-r--r--src/game/Channel.h168
-rw-r--r--src/game/ChatHandler.cpp54
-rw-r--r--src/game/Player.cpp16
-rw-r--r--src/game/World.cpp10
-rw-r--r--src/game/World.h8
-rw-r--r--src/shared/Log.cpp29
-rw-r--r--src/shared/Log.h4
-rw-r--r--src/trinitycore/trinitycore.conf.dist55
8 files changed, 259 insertions, 85 deletions
diff --git a/src/game/Channel.h b/src/game/Channel.h
index 866c2d4f8be..924046e4739 100644
--- a/src/game/Channel.h
+++ b/src/game/Channel.h
@@ -30,95 +30,95 @@
#include <map>
#include <string>
-class Channel
+enum ChatNotify
{
- enum ChatNotify
- {
- CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel.";
- CHAT_LEFT_NOTICE = 0x01, //+ "%s left channel.";
- //CHAT_SUSPENDED_NOTICE = 0x01, // "%s left channel.";
- CHAT_YOU_JOINED_NOTICE = 0x02, //+ "Joined Channel: [%s]"; -- You joined
- //CHAT_YOU_CHANGED_NOTICE = 0x02, // "Changed Channel: [%s]";
- CHAT_YOU_LEFT_NOTICE = 0x03, //+ "Left Channel: [%s]"; -- You left
- CHAT_WRONG_PASSWORD_NOTICE = 0x04, //+ "Wrong password for %s.";
- CHAT_NOT_MEMBER_NOTICE = 0x05, //+ "Not on channel %s.";
- CHAT_NOT_MODERATOR_NOTICE = 0x06, //+ "Not a moderator of %s.";
- CHAT_PASSWORD_CHANGED_NOTICE = 0x07, //+ "[%s] Password changed by %s.";
- CHAT_OWNER_CHANGED_NOTICE = 0x08, //+ "[%s] Owner changed to %s.";
- CHAT_PLAYER_NOT_FOUND_NOTICE = 0x09, //+ "[%s] Player %s was not found.";
- CHAT_NOT_OWNER_NOTICE = 0x0A, //+ "[%s] You are not the channel owner.";
- CHAT_CHANNEL_OWNER_NOTICE = 0x0B, //+ "[%s] Channel owner is %s.";
- CHAT_MODE_CHANGE_NOTICE = 0x0C, //?
- CHAT_ANNOUNCEMENTS_ON_NOTICE = 0x0D, //+ "[%s] Channel announcements enabled by %s.";
- CHAT_ANNOUNCEMENTS_OFF_NOTICE = 0x0E, //+ "[%s] Channel announcements disabled by %s.";
- CHAT_MODERATION_ON_NOTICE = 0x0F, //+ "[%s] Channel moderation enabled by %s.";
- CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s.";
- CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak.";
- CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s.";
- CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are banned from that channel.";
- CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s.";
- CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s.";
- CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not banned.";
- CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel.";
- CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'.";
- CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s.";
- CHAT_WRONG_FACTION_NOTICE = 0x1A, //+ "Wrong alliance for %s.";
- CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name";
- CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated";
- CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel";
- CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been banned.";
- CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message.";
- CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone.
- CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels.
- CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s.";
- CHAT_VOICE_OFF_NOTICE = 0x23, //+ "[%s] Channel voice disabled by %s.";
- };
+ CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel.";
+ CHAT_LEFT_NOTICE = 0x01, //+ "%s left channel.";
+ //CHAT_SUSPENDED_NOTICE = 0x01, // "%s left channel.";
+ CHAT_YOU_JOINED_NOTICE = 0x02, //+ "Joined Channel: [%s]"; -- You joined
+ //CHAT_YOU_CHANGED_NOTICE = 0x02, // "Changed Channel: [%s]";
+ CHAT_YOU_LEFT_NOTICE = 0x03, //+ "Left Channel: [%s]"; -- You left
+ CHAT_WRONG_PASSWORD_NOTICE = 0x04, //+ "Wrong password for %s.";
+ CHAT_NOT_MEMBER_NOTICE = 0x05, //+ "Not on channel %s.";
+ CHAT_NOT_MODERATOR_NOTICE = 0x06, //+ "Not a moderator of %s.";
+ CHAT_PASSWORD_CHANGED_NOTICE = 0x07, //+ "[%s] Password changed by %s.";
+ CHAT_OWNER_CHANGED_NOTICE = 0x08, //+ "[%s] Owner changed to %s.";
+ CHAT_PLAYER_NOT_FOUND_NOTICE = 0x09, //+ "[%s] Player %s was not found.";
+ CHAT_NOT_OWNER_NOTICE = 0x0A, //+ "[%s] You are not the channel owner.";
+ CHAT_CHANNEL_OWNER_NOTICE = 0x0B, //+ "[%s] Channel owner is %s.";
+ CHAT_MODE_CHANGE_NOTICE = 0x0C, //?
+ CHAT_ANNOUNCEMENTS_ON_NOTICE = 0x0D, //+ "[%s] Channel announcements enabled by %s.";
+ CHAT_ANNOUNCEMENTS_OFF_NOTICE = 0x0E, //+ "[%s] Channel announcements disabled by %s.";
+ CHAT_MODERATION_ON_NOTICE = 0x0F, //+ "[%s] Channel moderation enabled by %s.";
+ CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s.";
+ CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak.";
+ CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s.";
+ CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are banned from that channel.";
+ CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s.";
+ CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s.";
+ CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not banned.";
+ CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel.";
+ CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'.";
+ CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s.";
+ CHAT_WRONG_FACTION_NOTICE = 0x1A, //+ "Wrong alliance for %s.";
+ CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name";
+ CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated";
+ CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel";
+ CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been banned.";
+ CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message.";
+ CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone.
+ CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels.
+ CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s.";
+ CHAT_VOICE_OFF_NOTICE = 0x23, //+ "[%s] Channel voice disabled by %s.";
+};
- enum ChannelFlags
- {
- CHANNEL_FLAG_NONE = 0x00,
- CHANNEL_FLAG_CUSTOM = 0x01,
- // 0x02
- CHANNEL_FLAG_TRADE = 0x04,
- CHANNEL_FLAG_NOT_LFG = 0x08,
- CHANNEL_FLAG_GENERAL = 0x10,
- CHANNEL_FLAG_CITY = 0x20,
- CHANNEL_FLAG_LFG = 0x40,
- CHANNEL_FLAG_VOICE = 0x80
- // General 0x18 = 0x10 | 0x08
- // Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
- // LocalDefence 0x18 = 0x10 | 0x08
- // GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
- // LookingForGroup 0x50 = 0x40 | 0x10
- };
+enum ChannelFlags
+{
+ CHANNEL_FLAG_NONE = 0x00,
+ CHANNEL_FLAG_CUSTOM = 0x01,
+ // 0x02
+ CHANNEL_FLAG_TRADE = 0x04,
+ CHANNEL_FLAG_NOT_LFG = 0x08,
+ CHANNEL_FLAG_GENERAL = 0x10,
+ CHANNEL_FLAG_CITY = 0x20,
+ CHANNEL_FLAG_LFG = 0x40,
+ CHANNEL_FLAG_VOICE = 0x80
+ // General 0x18 = 0x10 | 0x08
+ // Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
+ // LocalDefence 0x18 = 0x10 | 0x08
+ // GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
+ // LookingForGroup 0x50 = 0x40 | 0x10
+};
- enum ChannelDBCFlags
- {
- CHANNEL_DBC_FLAG_NONE = 0x00000,
- CHANNEL_DBC_FLAG_INITIAL = 0x00001, // General, Trade, LocalDefense, LFG
- CHANNEL_DBC_FLAG_ZONE_DEP = 0x00002, // General, Trade, LocalDefense, GuildRecruitment
- CHANNEL_DBC_FLAG_GLOBAL = 0x00004, // WorldDefense
- CHANNEL_DBC_FLAG_TRADE = 0x00008, // Trade
- CHANNEL_DBC_FLAG_CITY_ONLY = 0x00010, // Trade, GuildRecruitment
- CHANNEL_DBC_FLAG_CITY_ONLY2 = 0x00020, // Trade, GuildRecruitment
- CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense
- CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment
- CHANNEL_DBC_FLAG_LFG = 0x40000 // LookingForGroup
- };
+enum ChannelDBCFlags
+{
+ CHANNEL_DBC_FLAG_NONE = 0x00000,
+ CHANNEL_DBC_FLAG_INITIAL = 0x00001, // General, Trade, LocalDefense, LFG
+ CHANNEL_DBC_FLAG_ZONE_DEP = 0x00002, // General, Trade, LocalDefense, GuildRecruitment
+ CHANNEL_DBC_FLAG_GLOBAL = 0x00004, // WorldDefense
+ CHANNEL_DBC_FLAG_TRADE = 0x00008, // Trade
+ CHANNEL_DBC_FLAG_CITY_ONLY = 0x00010, // Trade, GuildRecruitment
+ CHANNEL_DBC_FLAG_CITY_ONLY2 = 0x00020, // Trade, GuildRecruitment
+ CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense
+ CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment
+ CHANNEL_DBC_FLAG_LFG = 0x40000 // LookingForGroup
+};
- enum ChannelMemberFlags
- {
- MEMBER_FLAG_NONE = 0x00,
- MEMBER_FLAG_OWNER = 0x01,
- MEMBER_FLAG_MODERATOR = 0x02,
- MEMBER_FLAG_VOICED = 0x04,
- MEMBER_FLAG_MUTED = 0x08,
- MEMBER_FLAG_CUSTOM = 0x10,
- MEMBER_FLAG_MIC_MUTED = 0x20,
- // 0x40
- // 0x80
- };
+enum ChannelMemberFlags
+{
+ MEMBER_FLAG_NONE = 0x00,
+ MEMBER_FLAG_OWNER = 0x01,
+ MEMBER_FLAG_MODERATOR = 0x02,
+ MEMBER_FLAG_VOICED = 0x04,
+ MEMBER_FLAG_MUTED = 0x08,
+ MEMBER_FLAG_CUSTOM = 0x10,
+ MEMBER_FLAG_MIC_MUTED = 0x20,
+ // 0x40
+ // 0x80
+};
+class Channel
+{
struct PlayerInfo
{
uint64 player;
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index bf1c1add8a6..f7375931c54 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -86,6 +86,21 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if(lang == LANG_ADDON)
{
+ if(sWorld.getConfig(CONFIG_CHATLOG_ADDON))
+ {
+ std::string msg = "";
+ recv_data >> msg;
+
+ if(msg.empty())
+ {
+ sLog.outDebug("Player %s send empty addon msg", GetPlayer()->GetName());
+ return;
+ }
+
+ sLog.outChat("[ADDON] Player %s sends: %s",
+ GetPlayer()->GetName(), msg.c_str());
+ }
+
// Disabled addon channel?
if(!sWorld.getConfig(CONFIG_ADDON_CHANNEL))
return;
@@ -245,6 +260,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_PARTY, lang, NULL, 0, msg.c_str(),NULL);
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_PARTY))
+ sLog.outChat("[PARTY] Player %s tells group with leader %s: %s",
+ GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
}
break;
case CHAT_MSG_GUILD:
@@ -270,6 +289,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if (guild)
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_GUILD))
+ sLog.outChat("[GUILD] Player %s tells guild %s: %s",
+ GetPlayer()->GetName(), guild->GetName(), msg.c_str());
}
break;
@@ -297,6 +320,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if (guild)
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_GUILD))
+ sLog.outChat("[OFFICER] Player %s tells guild %s officers: %s",
+ GetPlayer()->GetName(), guild->GetName(), msg.c_str());
}
break;
}
@@ -327,6 +354,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID, lang, "", 0, msg.c_str(),NULL);
group->BroadcastPacket(&data, false);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
+ sLog.outChat("[RAID] Player %s tells raid with leader %s: %s",
+ GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
case CHAT_MSG_RAID_LEADER:
{
@@ -354,6 +385,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_LEADER, lang, "", 0, msg.c_str(),NULL);
group->BroadcastPacket(&data, false);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
+ sLog.outChat("[RAID] Leader player %s tells raid: %s",
+ GetPlayer()->GetName(), msg.c_str());
} break;
case CHAT_MSG_RAID_WARNING:
{
@@ -375,6 +410,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
//in battleground, raid warning is sent only to players in battleground - code is ok
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_WARNING, lang, "", 0, msg.c_str(),NULL);
group->BroadcastPacket(&data, false);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
+ sLog.outChat("[RAID] Leader player %s warns raid with: %s",
+ GetPlayer()->GetName(), msg.c_str());
} break;
case CHAT_MSG_BATTLEGROUND:
@@ -440,8 +479,21 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
- if(Channel *chn = cMgr->GetChannel(channel,_player))
+ Channel *chn = cMgr->GetChannel(channel,_player);
+ if(chn)
chn->Say(_player->GetGUID(),msg.c_str(),lang);
+
+ if(chn->HasFlag(CHANNEL_FLAG_TRADE) ||
+ chn->HasFlag(CHANNEL_FLAG_GENERAL) ||
+ chn->HasFlag(CHANNEL_FLAG_CITY) ||
+ chn->HasFlag(CHANNEL_FLAG_LFG))
+ if(sWorld.getConfig(CONFIG_CHATLOG_SYSCHAN))
+ sLog.outChat("[SYSCHAN] Player %s tells channel %s: %s",
+ GetPlayer()->GetName(), chn->GetName(), msg.c_str());
+ else
+ if(sWorld.getConfig(CONFIG_CHATLOG_CHANNEL))
+ sLog.outChat("[CHANNEL] Player %s tells channel %s: %s",
+ GetPlayer()->GetName(), chn->GetName(), msg.c_str());
}
} break;
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index bef57fd0a45..85d03fc2fd1 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17071,6 +17071,10 @@ void Player::Say(const std::string& text, const uint32 language)
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
+ sLog.outChat("[SAY] Player %s says (language %u): %s",
+ GetName(), language, text.c_str());
}
void Player::Yell(const std::string& text, const uint32 language)
@@ -17078,6 +17082,10 @@ void Player::Yell(const std::string& text, const uint32 language)
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
+ sLog.outChat("[YELL] Player %s yells (language %u): %s",
+ GetName(), language, text.c_str());
}
void Player::TextEmote(const std::string& text)
@@ -17085,6 +17093,10 @@ void Player::TextEmote(const std::string& text)
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT), true );
+
+ if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
+ sLog.outChat("[TEXTEMOTE] Player %s emotes: %s",
+ GetName(), text.c_str());
}
void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
@@ -17094,6 +17106,10 @@ void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
Player *rPlayer = objmgr.GetPlayer(receiver);
+ if(sWorld.getConfig(CONFIG_CHATLOG_WHISPER))
+ sLog.outChat("[WHISPER] Player %s tells %s: %s",
+ GetName(), rPlayer->GetName(), text.c_str());
+
// when player you are whispering to is dnd, he cannot receive your message, unless you are in gm mode
if(!rPlayer->isDND() || isGameMaster())
{
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 099914918b2..58af4efa4b8 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1085,6 +1085,16 @@ void World::LoadConfigSettings(bool reload)
token = strtok(NULL,delim);
}
delete[] forbiddenMaps;
+
+ // chat logging
+ m_configs[CONFIG_CHATLOG_CHANNEL] = sConfig.GetBoolDefault("ChatLogs.Channel", false);
+ m_configs[CONFIG_CHATLOG_WHISPER] = sConfig.GetBoolDefault("ChatLogs.Whisper", false);
+ m_configs[CONFIG_CHATLOG_SYSCHAN] = sConfig.GetBoolDefault("ChatLogs.SysChan", false);
+ m_configs[CONFIG_CHATLOG_PARTY] = sConfig.GetBoolDefault("ChatLogs.Party", false);
+ m_configs[CONFIG_CHATLOG_RAID] = sConfig.GetBoolDefault("ChatLogs.Raid", false);
+ m_configs[CONFIG_CHATLOG_GUILD] = sConfig.GetBoolDefault("ChatLogs.Guild", false);
+ m_configs[CONFIG_CHATLOG_PUBLIC] = sConfig.GetBoolDefault("ChatLogs.Public", false);
+ m_configs[CONFIG_CHATLOG_ADDON] = sConfig.GetBoolDefault("ChatLogs.Addon", false);
}
/// Initialize the World
diff --git a/src/game/World.h b/src/game/World.h
index f6d9045a406..f4195e94186 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -216,6 +216,14 @@ enum WorldConfigs
CONFIG_MIN_LOG_UPDATE,
CONFIG_ENABLE_SINFO_LOGIN,
CONFIG_OFFHAND_CHECK_AT_TALENTS_RESET,
+ CONFIG_CHATLOG_CHANNEL,
+ CONFIG_CHATLOG_WHISPER,
+ CONFIG_CHATLOG_SYSCHAN,
+ CONFIG_CHATLOG_PARTY,
+ CONFIG_CHATLOG_RAID,
+ CONFIG_CHATLOG_GUILD,
+ CONFIG_CHATLOG_PUBLIC,
+ CONFIG_CHATLOG_ADDON,
CONFIG_VALUE_COUNT
};
diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp
index 9f7167f9238..401394af1a5 100644
--- a/src/shared/Log.cpp
+++ b/src/shared/Log.cpp
@@ -95,6 +95,7 @@ void Log::Initialize()
m_dbChar = sConfig.GetBoolDefault("LogDB.Char", false);
m_dbRA = sConfig.GetBoolDefault("LogDB.RA", false);
m_dbGM = sConfig.GetBoolDefault("LogDB.GM", false);
+ m_dbChat = sConfig.GetBoolDefault("LogDB.Chat", false);
/// Common log files data
m_logsDir = sConfig.GetStringDefault("LogsDir","");
@@ -145,6 +146,7 @@ void Log::Initialize()
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
raLogfile = openLogFile("RaLogFile",NULL,"a");
+ chatLogfile = openLogFile("ChatLogFile",NULL,"a");
// Main log file settings
m_logLevel = sConfig.GetIntDefault("LogLevel", LOGL_NORMAL);
@@ -796,6 +798,33 @@ void Log::outRemote( const char * str, ... )
fflush(stdout);
}
+void Log::outChat( const char * str, ... )
+{
+ if( !str )
+ return;
+
+ if (m_enableLogDB && m_dbChat)
+ {
+ va_list ap2;
+ va_start(ap2, str);
+ char nnew_str[MAX_QUERY_LEN];
+ vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
+ outDB(LOG_TYPE_CHAT, nnew_str);
+ va_end(ap2);
+ }
+
+ if (chatLogfile)
+ {
+ va_list ap;
+ va_start(ap, str);
+ vfprintf(chatLogfile, str, ap);
+ fprintf(chatLogfile, "\n" );
+ fflush(chatLogfile);
+ va_end(ap);
+ }
+ fflush(stdout);
+}
+
void outstring_log(const char * str, ...)
{
if( !str )
diff --git a/src/shared/Log.h b/src/shared/Log.h
index a82b5a6a068..a0220b1bce7 100644
--- a/src/shared/Log.h
+++ b/src/shared/Log.h
@@ -47,6 +47,7 @@ enum LogTypes
LOG_TYPE_RA = 7,
LOG_TYPE_GM = 8,
LOG_TYPE_CRASH = 9,
+ LOG_TYPE_CHAT = 10,
MAX_LOG_TYPES
};
@@ -106,6 +107,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ZThr
void outChar( const char * str, ... ) ATTR_PRINTF(2,3);
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4);
void outRemote( const char * str, ... ) ATTR_PRINTF(2,3);
+ void outChat( const char * str, ... ) ATTR_PRINTF(2,3);
void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name );
static void outTimestamp(FILE* file);
@@ -133,6 +135,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ZThr
FILE* gmLogfile;
FILE* charLogfile;
FILE* dberLogfile;
+ FILE* chatLogfile;
// cache values for after initilization use (like gm log per account case)
std::string m_logsDir;
@@ -159,6 +162,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ZThr
bool m_dbChar;
bool m_dbRA;
bool m_dbGM;
+ bool m_dbChat;
bool m_charLog_Dump;
};
diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist
index 7e483380843..94af98eac2a 100644
--- a/src/trinitycore/trinitycore.conf.dist
+++ b/src/trinitycore/trinitycore.conf.dist
@@ -223,6 +223,11 @@ AddonChannel = 1
# Default: "Server.log"
# "" - Empty name disable creating log file
#
+# ChatLogFile
+# Log file for chat logs
+# Default: "chat.log"
+# "" - Empty name for disable
+#
# LogTimestamp
# Logfile with timestamp of server start in name
# Default: 0 - no timestamp in name
@@ -325,12 +330,53 @@ AddonChannel = 1
# Default: 0 - off
# 1 - on (very heavy)
#
+# LogDB.Chat
+# Enable/disable logging chat messages to the database.
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Channel
+# Enable logging chatting in custom channels.
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Whisper
+# Enable logging whispers between players.
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Party
+# Enable logging party messages.
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Raid
+# Enable logging raid messages.
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Guild
+# Enable logging guild messages.
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Public
+# Enable logging public chat events (say/yell/emote).
+# Default: 0 - off
+# 1 - on
+#
+# ChatLogs.Addon
+# Enable logging addon messages.
+# Default: 0 - off
+# 1 - on
+#
###################################################################################################################
LogSQL = 1
PidFile = ""
LogLevel = 1
LogFile = "Server.log"
+ChatLogFile = "chat.log"
LogTimestamp = 0
LogFileLevel = 0
LogFilter_AchievementUpdates = 1
@@ -353,6 +399,15 @@ LogDB.Char = 0
LogDB.GM = 0
LogDB.RA = 0
LogDB.World = 0
+LogDB.Chat = 0
+ChatLogs.Channel = 0
+ChatLogs.SysChan = 0
+ChatLogs.Whisper = 0
+ChatLogs.Party = 0
+ChatLogs.Raid = 0
+ChatLogs.Guild = 0
+ChatLogs.Public = 0
+ChatLogs.Addon = 0
###################################################################################################################
# SERVER SETTINGS