Browse Source

IRCPrefix is now parsed for tags

Added tags: {SERVERHOST}, {SERVERPORT}, {SOCKHOST}, {SOCKPORT}
pull/3/head
JustinAJ 10 years ago
parent
commit
1649b768fa
  1. BIN
      Release/Bot.lib
  2. BIN
      Release/Plugins/RenX.Core.lib
  3. 7
      RenX.Core/RenX_Server.cpp
  4. 16
      RenX.Core/RenX_Tags.cpp
  5. 8
      RenX.Core/RenX_Tags.h

BIN
Release/Bot.lib

Binary file not shown.

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

7
RenX.Core/RenX_Server.cpp

@ -26,6 +26,7 @@
#include "RenX_Functions.h" #include "RenX_Functions.h"
#include "RenX_Plugin.h" #include "RenX_Plugin.h"
#include "RenX_BanDatabase.h" #include "RenX_BanDatabase.h"
#include "RenX_Tags.h"
int RenX::Server::think() int RenX::Server::think()
{ {
@ -476,12 +477,14 @@ bool RenX::Server::changeTeam(RenX::PlayerInfo *player, bool resetCredits)
const Jupiter::ReadableString &RenX::Server::getPrefix() const const Jupiter::ReadableString &RenX::Server::getPrefix() const
{ {
return RenX::Server::IRCPrefix; static Jupiter::StringS parsed;
RenX::processTags(parsed = RenX::Server::IRCPrefix, this);
return parsed;
} }
void RenX::Server::setPrefix(const Jupiter::ReadableString &prefix) void RenX::Server::setPrefix(const Jupiter::ReadableString &prefix)
{ {
RenX::Server::IRCPrefix = prefix; RenX::sanitizeTags(RenX::Server::IRCPrefix = prefix);
} }
const Jupiter::ReadableString &RenX::Server::getCommandPrefix() const const Jupiter::ReadableString &RenX::Server::getCommandPrefix() const

16
RenX.Core/RenX_Tags.cpp

@ -71,6 +71,10 @@ TagsImp::TagsImp()
this->INTERNAL_USER_TAG = this->getUniqueInternalTag(); this->INTERNAL_USER_TAG = this->getUniqueInternalTag();
this->INTERNAL_SERVER_NAME_TAG = this->getUniqueInternalTag(); this->INTERNAL_SERVER_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_MAP_TAG = this->getUniqueInternalTag(); this->INTERNAL_MAP_TAG = this->getUniqueInternalTag();
this->INTERNAL_SERVER_HOSTNAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_SERVER_PORT_TAG = this->getUniqueInternalTag();
this->INTERNAL_SOCKET_HOSTNAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_SOCKET_PORT_TAG = this->getUniqueInternalTag();
/** Player tags*/ /** Player tags*/
this->INTERNAL_NAME_TAG = this->getUniqueInternalTag(); this->INTERNAL_NAME_TAG = this->getUniqueInternalTag();
@ -163,6 +167,10 @@ TagsImp::TagsImp()
this->userTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("UserTag"), STRING_LITERAL_AS_REFERENCE("{USER}")); this->userTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("UserTag"), STRING_LITERAL_AS_REFERENCE("{USER}"));
this->serverNameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("ServerNameTag"), STRING_LITERAL_AS_REFERENCE("{SERVERNAME}")); this->serverNameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("ServerNameTag"), STRING_LITERAL_AS_REFERENCE("{SERVERNAME}"));
this->mapTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("MapTag"), STRING_LITERAL_AS_REFERENCE("{MAP}")); this->mapTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("MapTag"), STRING_LITERAL_AS_REFERENCE("{MAP}"));
this->serverHostnameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("ServerHostnameTag"), STRING_LITERAL_AS_REFERENCE("{SERVERHOST}"));
this->serverPortTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("ServerPortTag"), STRING_LITERAL_AS_REFERENCE("{SERVERPORT}"));
this->socketHostnameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("SocketHostnameTag"), STRING_LITERAL_AS_REFERENCE("{SOCKHOST}"));
this->socketPortTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("SocketPortTag"), STRING_LITERAL_AS_REFERENCE("{SOCKPORT}"));
/** Player tags */ /** Player tags */
this->nameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("NameTag"), STRING_LITERAL_AS_REFERENCE("{NAME}")); this->nameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("NameTag"), STRING_LITERAL_AS_REFERENCE("{NAME}"));
@ -255,6 +263,10 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
msg.replace(this->INTERNAL_USER_TAG, server->getUser()); msg.replace(this->INTERNAL_USER_TAG, server->getUser());
msg.replace(this->INTERNAL_SERVER_NAME_TAG, server->getName()); msg.replace(this->INTERNAL_SERVER_NAME_TAG, server->getName());
msg.replace(this->INTERNAL_MAP_TAG, server->getMap()); msg.replace(this->INTERNAL_MAP_TAG, server->getMap());
msg.replace(this->INTERNAL_SERVER_HOSTNAME_TAG, server->getHostname());
msg.replace(this->INTERNAL_SERVER_PORT_TAG, Jupiter::StringS::Format("%u", server->getPort()));
msg.replace(this->INTERNAL_SOCKET_HOSTNAME_TAG, server->getSocketHostname());
msg.replace(this->INTERNAL_SOCKET_PORT_TAG, Jupiter::StringS::Format("%u", server->getSocketPort()));
if (player != nullptr) if (player != nullptr)
{ {
msg.replace(this->INTERNAL_STEAM_TAG, server->formatSteamID(player)); msg.replace(this->INTERNAL_STEAM_TAG, server->formatSteamID(player));
@ -353,6 +365,10 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt)
fmt.replace(this->userTag, this->INTERNAL_USER_TAG); fmt.replace(this->userTag, this->INTERNAL_USER_TAG);
fmt.replace(this->serverNameTag, this->INTERNAL_SERVER_NAME_TAG); fmt.replace(this->serverNameTag, this->INTERNAL_SERVER_NAME_TAG);
fmt.replace(this->mapTag, this->INTERNAL_MAP_TAG); fmt.replace(this->mapTag, this->INTERNAL_MAP_TAG);
fmt.replace(this->serverHostnameTag, this->INTERNAL_SERVER_HOSTNAME_TAG);
fmt.replace(this->serverPortTag, this->INTERNAL_SERVER_PORT_TAG);
fmt.replace(this->socketHostnameTag, this->INTERNAL_SOCKET_HOSTNAME_TAG);
fmt.replace(this->socketPortTag, this->INTERNAL_SOCKET_PORT_TAG);
/** Player tags */ /** Player tags */
fmt.replace(this->nameTag, this->INTERNAL_NAME_TAG); fmt.replace(this->nameTag, this->INTERNAL_NAME_TAG);

8
RenX.Core/RenX_Tags.h

@ -60,6 +60,10 @@ namespace RenX
Jupiter::StringS INTERNAL_USER_TAG; Jupiter::StringS INTERNAL_USER_TAG;
Jupiter::StringS INTERNAL_SERVER_NAME_TAG; Jupiter::StringS INTERNAL_SERVER_NAME_TAG;
Jupiter::StringS INTERNAL_MAP_TAG; Jupiter::StringS INTERNAL_MAP_TAG;
Jupiter::StringS INTERNAL_SERVER_HOSTNAME_TAG;
Jupiter::StringS INTERNAL_SERVER_PORT_TAG;
Jupiter::StringS INTERNAL_SOCKET_HOSTNAME_TAG;
Jupiter::StringS INTERNAL_SOCKET_PORT_TAG;
/** Player tags */ /** Player tags */
Jupiter::StringS INTERNAL_NAME_TAG; Jupiter::StringS INTERNAL_NAME_TAG;
@ -152,6 +156,10 @@ namespace RenX
Jupiter::StringS userTag; Jupiter::StringS userTag;
Jupiter::StringS serverNameTag; Jupiter::StringS serverNameTag;
Jupiter::StringS mapTag; Jupiter::StringS mapTag;
Jupiter::StringS serverHostnameTag;
Jupiter::StringS serverPortTag;
Jupiter::StringS socketHostnameTag;
Jupiter::StringS socketPortTag;
/** Player tags */ /** Player tags */
Jupiter::StringS nameTag; Jupiter::StringS nameTag;

Loading…
Cancel
Save