Browse Source

Added "NeverSay" configurable option

pull/3/head
JustinAJ 10 years ago
parent
commit
bd31da4871
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 15
      RenX.Core/RenX_Server.cpp
  3. 18
      RenX.Core/RenX_Server.h

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

15
RenX.Core/RenX_Server.cpp

@ -117,6 +117,17 @@ int RenX::Server::send(const Jupiter::ReadableString &command)
} }
int RenX::Server::sendMessage(const Jupiter::ReadableString &message) int RenX::Server::sendMessage(const Jupiter::ReadableString &message)
{
int r = 0;
if (RenX::Server::neverSay)
{
if (RenX::Server::profile->privateMessages && RenX::Server::players.size() != 0)
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = RenX::Server::players.getNode(0); node != nullptr; node = node->next)
if (node->data->isBot == false)
r += RenX::Server::sendMessage(node->data, message);
return r;
}
else
{ {
char *t = new char[message.size() + 6]; char *t = new char[message.size() + 6];
strcpy(t, "csay "); strcpy(t, "csay ");
@ -124,10 +135,11 @@ int RenX::Server::sendMessage(const Jupiter::ReadableString &message)
t[message.size() + 5] = '\n'; t[message.size() + 5] = '\n';
if (RenX::Server::profile->mustSanitize) if (RenX::Server::profile->mustSanitize)
RenX::sanitizeString(t); RenX::sanitizeString(t);
int r = RenX::Server::sock.send(t, message.size() + 6); r = RenX::Server::sock.send(t, message.size() + 6);
delete[] t; delete[] t;
return r; return r;
} }
}
int RenX::Server::sendMessage(RenX::PlayerInfo *player, const Jupiter::ReadableString &message) int RenX::Server::sendMessage(RenX::PlayerInfo *player, const Jupiter::ReadableString &message)
{ {
@ -1022,6 +1034,7 @@ RenX::Server::Server(const Jupiter::ReadableString &configurationSection)
RenX::Server::delay = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("ReconnectDelay"), 60); RenX::Server::delay = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("ReconnectDelay"), 60);
RenX::Server::uuidMode = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("UUIDMode"), 0); RenX::Server::uuidMode = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("UUIDMode"), 0);
RenX::Server::steamFormat = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("SteamFormat"), 16); RenX::Server::steamFormat = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("SteamFormat"), 16);
RenX::Server::neverSay = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, STRING_LITERAL_AS_REFERENCE("NeverSay"), false);
for (size_t i = 0; i < RenX::GameMasterCommandList->size(); i++) for (size_t i = 0; i < RenX::GameMasterCommandList->size(); i++)
RenX::Server::addCommand(RenX::GameMasterCommandList->get(i)->copy()); RenX::Server::addCommand(RenX::GameMasterCommandList->get(i)->copy());

18
RenX.Core/RenX_Server.h

@ -470,22 +470,29 @@ namespace RenX
/** Private members */ /** Private members */
private: private:
/** Tracking variables */
bool connected = false; bool connected = false;
bool needsCList = false; bool needsCList = false;
bool silenceParts = false; bool silenceParts = false;
bool silenceJoins = false; bool silenceJoins = false;
bool firstGame = true; bool firstGame = true;
bool firstKill = false;
bool firstDeath = false;
bool firstAction = false;
unsigned int rconVersion = 0; unsigned int rconVersion = 0;
time_t lastAttempt = 0;
Jupiter::String lastLine;
Jupiter::StringS gameVersion;
Jupiter::ArrayList<RenX::GameCommand> commands;
/** Configuration variables */
unsigned short port; unsigned short port;
int logChanType; int logChanType;
int adminLogChanType; int adminLogChanType;
time_t lastAttempt = 0;
time_t delay; time_t delay;
int steamFormat; /** 16 = hex, 10 = base 10, 8 = octal, -2 = SteamID 2, -3 = SteamID 3 */ int steamFormat; /** 16 = hex, 10 = base 10, 8 = octal, -2 = SteamID 2, -3 = SteamID 3 */
unsigned int uuidMode; /** 0 = steam, 1 = nickname */ unsigned int uuidMode; /** 0 = steam, 1 = nickname */
bool firstKill = false; bool neverSay;
bool firstDeath = false;
bool firstAction = false;
Jupiter::TCPSocket sock; Jupiter::TCPSocket sock;
Jupiter::CStringS clientHostname; Jupiter::CStringS clientHostname;
Jupiter::CStringS hostname; Jupiter::CStringS hostname;
@ -494,9 +501,6 @@ namespace RenX
Jupiter::StringS rules; Jupiter::StringS rules;
Jupiter::StringS IRCPrefix; Jupiter::StringS IRCPrefix;
Jupiter::StringS CommandPrefix; Jupiter::StringS CommandPrefix;
Jupiter::StringS gameVersion;
Jupiter::String lastLine;
Jupiter::ArrayList<RenX::GameCommand> commands;
}; };
} }

Loading…
Cancel
Save