From ab30b97cc1c6a0d816fd3f8b4c28c8744cc0d554 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Wed, 8 Jul 2015 12:41:50 -0400 Subject: [PATCH] Added Radio chat IRC logging --- RenX.Logging/RenX_Logging.cpp | 24 +++++++++++++++++++++++- RenX.Logging/RenX_Logging.h | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/RenX.Logging/RenX_Logging.cpp b/RenX.Logging/RenX_Logging.cpp index d2ba406..0c1e706 100644 --- a/RenX.Logging/RenX_Logging.cpp +++ b/RenX.Logging/RenX_Logging.cpp @@ -34,7 +34,8 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::teamChangePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TeamChangePublic"), true); RenX_LoggingPlugin::playerPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("PlayerPublic"), false); RenX_LoggingPlugin::chatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("ChatPublic"), true); - RenX_LoggingPlugin::teamChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TeamChatPublic"), true); + RenX_LoggingPlugin::teamChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TeamChatPublic"), false); + RenX_LoggingPlugin::radioChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("RadioChatPublic"), false); RenX_LoggingPlugin::hostChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("HostChatPublic"), true); RenX_LoggingPlugin::hostPagePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("HostPagePublic"), false); RenX_LoggingPlugin::otherChatPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("OtherChatPublic"), false); @@ -134,6 +135,9 @@ void RenX_LoggingPlugin::init() RenX_LoggingPlugin::teamChatFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("TeamChatFormat"), Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD ": %.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::radioChatFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("RadioChatFormat"), + Jupiter::StringS::Format(IRCBOLD "%.*s" IRCBOLD ": \x1D%.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); + RenX_LoggingPlugin::hostChatFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("HostChatFormat"), Jupiter::StringS::Format(IRCCOLOR "12Host" IRCCOLOR "0: %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr())); @@ -385,6 +389,7 @@ void RenX_LoggingPlugin::init() RenX::sanitizeTags(playerFmt); RenX::sanitizeTags(chatFmt); RenX::sanitizeTags(teamChatFmt); + RenX::sanitizeTags(radioChatFmt); RenX::sanitizeTags(otherChatFmt); RenX::sanitizeTags(deployFmt); RenX::sanitizeTags(mineDeployFmt); @@ -627,6 +632,23 @@ void RenX_LoggingPlugin::RenX_OnTeamChat(RenX::Server *server, const RenX::Playe } } +void RenX_LoggingPlugin::RenX_OnRadioChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) +{ + logFuncType func; + if (RenX_LoggingPlugin::radioChatPublic) + func = &RenX::Server::sendLogChan; + else + func = &RenX::Server::sendAdmChan; + + Jupiter::String msg = this->radioChatFmt; + if (msg.isNotEmpty()) + { + RenX::processTags(msg, server, player); + msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, message); + (server->*func)(msg); + } +} + void RenX_LoggingPlugin::RenX_OnHostChat(RenX::Server *server, const Jupiter::ReadableString &message) { logFuncType func; diff --git a/RenX.Logging/RenX_Logging.h b/RenX.Logging/RenX_Logging.h index b1935f9..d62876c 100644 --- a/RenX.Logging/RenX_Logging.h +++ b/RenX.Logging/RenX_Logging.h @@ -34,6 +34,7 @@ class RenX_LoggingPlugin : public RenX::Plugin void RenX_OnChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnTeamChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; + void RenX_OnRadioChat(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnHostChat(RenX::Server *server, const Jupiter::ReadableString &message) override; void RenX_OnHostPage(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &message) override; void RenX_OnOtherChat(RenX::Server *server, const Jupiter::ReadableString &raw) override; @@ -131,6 +132,7 @@ class RenX_LoggingPlugin : public RenX::Plugin unsigned int playerPublic : 1; unsigned int chatPublic : 1; unsigned int teamChatPublic : 1; + unsigned int radioChatPublic : 1; unsigned int hostChatPublic : 1; unsigned int hostPagePublic : 1; unsigned int otherChatPublic : 1; @@ -205,6 +207,7 @@ class RenX_LoggingPlugin : public RenX::Plugin Jupiter::StringS playerFmt; Jupiter::StringS chatFmt; Jupiter::StringS teamChatFmt; + Jupiter::StringS radioChatFmt; Jupiter::StringS hostChatFmt; Jupiter::StringS hostPageFmt; Jupiter::StringS otherChatFmt;