Skip to content

Commit

Permalink
Added Radio chat IRC logging
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinAJ committed Jul 8, 2015
1 parent 7bee8d4 commit ab30b97
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 23 additions & 1 deletion RenX.Logging/RenX_Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()));

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions RenX.Logging/RenX_Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ab30b97

Please sign in to comment.