Browse Source

Removed HashTable, CString

Added JUPITER_SOCK_EWOULDBLOCK
Code now runs and compiles on linux
release/0.19
Jessica James 5 years ago
parent
commit
b5be8296d4
  1. 2
      src/Bot/include/IRC_Command.h
  2. 19
      src/Bot/src/IRC_Bot.cpp
  3. 2
      src/Bot/src/IRC_Command.cpp
  4. 2
      src/Jupiter
  5. 19
      src/Plugins/ChannelRelay/ChannelRelay.cpp
  6. 18
      src/Plugins/ExtraCommands/ExtraCommands.cpp
  7. 5
      src/Plugins/FunCommands/FunCommands.cpp
  8. 1
      src/Plugins/RenX/RenX.Announcements/RenX_Announcements.h
  9. 24
      src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp
  10. 19
      src/Plugins/RenX/RenX.Core/RenX_BanDatabase.cpp
  11. 10
      src/Plugins/RenX/RenX.Core/RenX_BanDatabase.h
  12. 2
      src/Plugins/RenX/RenX.Core/RenX_Core.cpp
  13. 4
      src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.cpp
  14. 5
      src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.h
  15. 2
      src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.cpp
  16. 2
      src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.h
  17. 237
      src/Plugins/RenX/RenX.Core/RenX_Server.cpp
  18. 9
      src/Plugins/RenX/RenX.Core/RenX_Server.h
  19. 8
      src/Plugins/RenX/RenX.Core/RenX_Tags.cpp
  20. 5
      src/Plugins/RenX/RenX.Core/RenX_Tags.h
  21. 4
      src/Plugins/RenX/RenX.ExtraLogging/RenX_ExtraLogging.cpp
  22. 60
      src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.cpp
  23. 18
      src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.h
  24. 9
      src/Plugins/RenX/RenX.Listen/RenX_Listen.cpp
  25. 2
      src/Plugins/RenX/RenX.Medals/RenX_Medals.cpp
  26. 25
      src/Plugins/RenX/RenX.ModSystem/RenX_ModSystem.cpp
  27. 12
      src/Plugins/RenX/RenX.ServerList/RenX_ServerList.cpp

2
src/Bot/include/IRC_Command.h

@ -207,7 +207,7 @@ public:
/**
* @brief Copy constructor for the GenericCommandWrapperIRCCommand class
*/
GenericCommandWrapperIRCCommand(GenericCommandWrapperIRCCommand &in_command);
GenericCommandWrapperIRCCommand(const GenericCommandWrapperIRCCommand &in_command);
/**
* @brief Wrapper constructor for the GenericCommandWrapperIRCCommand class

19
src/Bot/src/IRC_Bot.cpp

@ -116,20 +116,19 @@ void IRC_Bot::setCommandAccessLevels(IRCCommand *in_command)
if (section == nullptr)
return;
auto read_section = [this, section, in_command](Jupiter::HashTable::Bucket::Entry &in_entry)
{
for (auto& entry : section->getTable()) {
size_t tmp_index;
Jupiter::ReferenceString tmp_key, tmp_sub_key;
IRCCommand *command;
tmp_index = in_entry.key.find('.');
tmp_index = entry.first.find('.');
if (tmp_index != Jupiter::INVALID_INDEX)
{
// non-default access assignment
tmp_key.set(in_entry.key.ptr(), tmp_index);
tmp_key.set(entry.first.ptr(), tmp_index);
tmp_sub_key = in_entry.key;
tmp_sub_key = entry.first;
tmp_sub_key.shiftRight(tmp_index + 1);
if (tmp_sub_key.findi("Type."_jrs) == 0)
@ -138,7 +137,7 @@ void IRC_Bot::setCommandAccessLevels(IRCCommand *in_command)
command = this->getCommand(tmp_key);
if (command != nullptr && (in_command == nullptr || in_command == command))
command->setAccessLevel(tmp_sub_key.asInt(), in_entry.value.asInt());
command->setAccessLevel(tmp_sub_key.asInt(), entry.second.asInt());
}
else if (tmp_sub_key.findi("Channel."_jrs) == 0)
{
@ -147,19 +146,17 @@ void IRC_Bot::setCommandAccessLevels(IRCCommand *in_command)
// Assign access level to command (if command exists)
command = this->getCommand(tmp_key);
if (command != nullptr && (in_command == nullptr || in_command == command))
command->setAccessLevel(tmp_sub_key, in_entry.value.asInt());
command->setAccessLevel(tmp_sub_key, entry.second.asInt());
}
}
else
{
// Assign access level to command (if command exists)
command = this->getCommand(in_entry.key);
command = this->getCommand(entry.first);
if (command != nullptr && (in_command == nullptr || in_command == command))
command->setAccessLevel(in_entry.value.asInt());
command->setAccessLevel(entry.second.asInt());
}
};
section->getTable().callback(read_section);
};
set_command_access_levels(this->getSecondaryConfigSection());

2
src/Bot/src/IRC_Command.cpp

@ -130,7 +130,7 @@ void IRCCommand::create()
/** GenericCommandWrapperIRCCommand */
GenericCommandWrapperIRCCommand::GenericCommandWrapperIRCCommand(GenericCommandWrapperIRCCommand &in_command) : IRCCommand(in_command)
GenericCommandWrapperIRCCommand::GenericCommandWrapperIRCCommand(const GenericCommandWrapperIRCCommand &in_command) : IRCCommand(in_command)
{
GenericCommandWrapperIRCCommand::m_command = in_command.m_command;

2
src/Jupiter

@ -1 +1 @@
Subproject commit cfcc27e7d9ca2263cab592e1f619e7d825f746e2
Subproject commit cf77a1b6a72491686f370be33bc367f28bebeb40

19
src/Plugins/ChannelRelay/ChannelRelay.cpp

@ -53,7 +53,6 @@ void ChannelRelayPlugin::OnChat(Jupiter::IRC::Client *server, const Jupiter::Rea
int type = chan->getType();
if (ChannelRelayPlugin::types.contains(type))
{
unsigned int count = server->getChannelCount();
unsigned int serverCount = serverManager->size();
char prefix = chan->getUserPrefix(nick);
Jupiter::String str;
@ -64,16 +63,14 @@ void ChannelRelayPlugin::OnChat(Jupiter::IRC::Client *server, const Jupiter::Rea
str = "<"_js + prefix + nick + "> "_jrs + message;
}
Jupiter::IRC::Client *irc_server;
auto relay_channels_callback = [irc_server, type, chan, &str](Jupiter::IRC::Client::ChannelTableType::Bucket::Entry &in_entry)
{
if (in_entry.value.getType() == type && &in_entry.value != chan)
irc_server->sendMessage(in_entry.value.getName(), str);
};
while (serverCount != 0)
serverManager->getServer(--serverCount)->getChannels().callback(relay_channels_callback);
while (serverCount != 0) {
auto server = serverManager->getServer(--serverCount);
for (auto& channel : server->getChannels()) {
if (channel.second.getType() == type && &channel.second != chan) {
server->sendMessage(channel.second.getName(), str);
}
}
}
}
}
}

18
src/Plugins/ExtraCommands/ExtraCommands.cpp

@ -258,24 +258,18 @@ Jupiter::GenericCommand::ResponseLine *DebugInfoGenericCommand::trigger(const Ju
line->next = new Jupiter::GenericCommand::ResponseLine(Jupiter::StringS::Format("Outputting data for %u channels...", server->getChannelCount()), GenericCommand::DisplayType::PublicSuccess);
line = line->next;
auto debug_callback = [&line](Jupiter::IRC::Client::ChannelTableType::Bucket::Entry &in_entry)
{
line->next = new Jupiter::GenericCommand::ResponseLine(Jupiter::StringS::Format("Channel %.*s - Type: %d", in_entry.value.getName().size(), in_entry.value.getName().ptr(), in_entry.value.getType()), GenericCommand::DisplayType::PublicSuccess);
for (auto& channel_pair : server->getChannels()) {
auto& channel = channel_pair.second;
line->next = new Jupiter::GenericCommand::ResponseLine(Jupiter::StringS::Format("Channel %.*s - Type: %d", channel.getName().size(), channel.getName().ptr(), channel.getType()), GenericCommand::DisplayType::PublicSuccess);
line = line->next;
auto debug_user_callback = [&line, &in_entry](Jupiter::IRC::Client::Channel::UserTableType::Bucket::Entry &in_user_entry)
{
Jupiter::IRC::Client::User *user = in_user_entry.value.getUser();
line->next = new Jupiter::GenericCommand::ResponseLine(Jupiter::StringS::Format("User %.*s!%.*s@%.*s (prefix: %c) of channel %.*s (of %u shared)", user->getNickname().size(), user->getNickname().ptr(), user->getUsername().size(), user->getUsername().ptr(), user->getHostname().size(), user->getHostname().ptr(), in_entry.value.getUserPrefix(in_user_entry.value) ? in_entry.value.getUserPrefix(in_user_entry.value) : ' ', in_entry.value.getName().size(), in_entry.value.getName().ptr(), user->getChannelCount()), GenericCommand::DisplayType::PublicSuccess);
for (auto& user_pair : channel.getUsers()) {
Jupiter::IRC::Client::User *user = user_pair.second.getUser();
line->next = new Jupiter::GenericCommand::ResponseLine(Jupiter::StringS::Format("User %.*s!%.*s@%.*s (prefix: %c) of channel %.*s (of %u shared)", user->getNickname().size(), user->getNickname().ptr(), user->getUsername().size(), user->getUsername().ptr(), user->getHostname().size(), user->getHostname().ptr(), channel.getUserPrefix(user_pair.second) ? channel.getUserPrefix(user_pair.second) : ' ', channel.getName().size(), channel.getName().ptr(), user->getChannelCount()), GenericCommand::DisplayType::PublicSuccess);
line = line->next;
};
in_entry.value.getUsers().callback(debug_user_callback);
};
for (unsigned int index = 0; index < server->getChannelCount(); ++index)
server->getChannels().callback(debug_callback);
return ret;
}

5
src/Plugins/FunCommands/FunCommands.cpp

@ -19,7 +19,6 @@
#include <cstring>
#include "Jupiter/Functions.h"
#include "Jupiter/Socket.h"
#include "Jupiter/CString.h"
#include "FunCommands.h"
#include "IRC_Bot.h"
@ -167,14 +166,14 @@ Jupiter::GenericCommand::ResponseLine *ResolveGenericCommand::trigger(const Jupi
Jupiter::ReferenceString command = Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE);
if (command.equalsi("hostname"_jrs) || command.equalsi("host"_jrs))
{
Jupiter::ReferenceString resolved = Jupiter::Socket::resolveHostname(Jupiter::CStringS::gotoWord(parameters, 1, WHITESPACE).c_str(), 0);
Jupiter::ReferenceString resolved = Jupiter::Socket::resolveHostname(static_cast<std::string>(Jupiter::ReferenceString::gotoWord(parameters, 1, WHITESPACE)).c_str(), 0);
if (resolved.isEmpty())
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to resolve."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine(resolved, GenericCommand::DisplayType::PublicSuccess);
}
else if (command.equalsi("ip"_jrs))
{
Jupiter::ReferenceString resolved = Jupiter::Socket::resolveAddress(Jupiter::CStringS::gotoWord(parameters, 1, WHITESPACE).c_str(), 0);
Jupiter::ReferenceString resolved = Jupiter::Socket::resolveAddress(static_cast<std::string>(Jupiter::ReferenceString::gotoWord(parameters, 1, WHITESPACE)).c_str(), 0);
if (resolved.isEmpty())
return new Jupiter::GenericCommand::ResponseLine("Error: Unable to resolve."_jrs, GenericCommand::DisplayType::PublicError);
return new Jupiter::GenericCommand::ResponseLine(resolved, GenericCommand::DisplayType::PublicSuccess);

1
src/Plugins/RenX/RenX.Announcements/RenX_Announcements.h

@ -23,7 +23,6 @@
#include "Jupiter/Timer.h"
#include "Jupiter/File.h"
#include "Jupiter/String.hpp"
#include "Jupiter/CString.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"

24
src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp

@ -1267,7 +1267,7 @@ void ReconnectIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
if (server->isLogChanType(type))
{
if (server->reconnect(RenX::DisconnectReason::Triggered)) msg.set("Connection established");
else msg.format("[RenX] ERROR: Failed to connect to %.*s on port %u." ENDL, server->getHostname().size(), server->getHostname().ptr(), server->getPort());
else msg.format("[RenX] ERROR: Failed to connect to %.*s on port %u." ENDL, server->getHostname().size(), server->getHostname().c_str(), server->getPort());
source->sendMessage(channel, msg);
}
}
@ -2104,7 +2104,7 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
{
size_t index = 0;
Jupiter::ReferenceString name;
Jupiter::CStringS ip_str;
std::string ip_str;
uint32_t ip = 0U;
uint8_t prefix_length = 32U;
uint64_t steamid = 0U;
@ -2138,7 +2138,7 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
return;
}
ip_str = Jupiter::ReferenceString::getWord(parameters, index++, ADDBAN_WHITESPACE);
ip_str = static_cast<std::string>(Jupiter::ReferenceString::getWord(parameters, index++, ADDBAN_WHITESPACE));
}
else if (word.equalsi("Steam"_jrs) || word.equalsi("SteamID"_jrs))
{
@ -2217,13 +2217,13 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
flags = RenX::BanDatabase::Entry::FLAG_TYPE_GAME;
index = ip_str.find('/');
if (index != JUPITER_INVALID_INDEX)
if (index != std::string::npos)
{
Jupiter::ReferenceString prefix_length_str(ip_str.c_str() + index + 1);
prefix_length = prefix_length_str.asUnsignedInt();
if (prefix_length == 0)
prefix_length = 32U;
ip_str.truncate(prefix_length_str.size() + 1);
ip_str.erase(index);
}
ip = Jupiter::Socket::pton4(ip_str.c_str());
@ -2555,7 +2555,7 @@ void AddExemptionIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStr
else
{
size_t index = 0;
Jupiter::CStringS ip_str;
std::string ip_str;
uint32_t ip = 0U;
uint8_t prefix_length = 32U;
uint64_t steamid = 0U;
@ -2576,7 +2576,7 @@ void AddExemptionIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStr
return;
}
ip_str = Jupiter::ReferenceString::getWord(parameters, index++, ADDEXEMPTION_WHITESPACE);
ip_str = static_cast<std::string>(Jupiter::ReferenceString::getWord(parameters, index++, ADDEXEMPTION_WHITESPACE));
}
else if (word.equalsi("Steam"_jrs) || word.equalsi("SteamID"_jrs))
{
@ -2613,16 +2613,16 @@ void AddExemptionIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStr
if (flags == 0)
flags = RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN;
if (ip_str.isNotEmpty())
if (!ip_str.empty())
{
index = ip_str.find('/');
if (index != JUPITER_INVALID_INDEX)
if (index != std::string::npos)
{
Jupiter::ReferenceString prefix_length_str(ip_str.c_str() + index + 1);
prefix_length = prefix_length_str.asUnsignedInt();
if (prefix_length == 0)
prefix_length = 32U;
ip_str.truncate(prefix_length_str.size() + 1);
ip_str.erase(index);
}
ip = Jupiter::Socket::pton4(ip_str.c_str());
@ -3205,7 +3205,7 @@ void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *play
Jupiter::StringL user_message = Jupiter::StringL::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game; please look in ", staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr());
Jupiter::StringS channel_message = Jupiter::StringS::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game!" IRCCOLOR, staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr());
auto alert_message_callback = [this, source, server, &user_message, &channel_message, &messageCount](Jupiter::IRC::Client::ChannelTableType::Bucket::Entry &in_entry)
/*auto alert_message_callback = [this, source, server, &user_message, &channel_message, &messageCount](Jupiter::IRC::Client::ChannelTableType::Bucket::Entry &in_entry)
{
auto alert_message_user_callback = [server, &in_entry, &user_message, &messageCount](Jupiter::IRC::Client::Channel::UserTableType::Bucket::Entry &in_user_entry)
{
@ -3224,7 +3224,7 @@ void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *play
in_entry.value.getUsers().callback(alert_message_user_callback);
user_message -= in_entry.value.getName().size();
}
};
};*/
source->sendMessage(*player, Jupiter::StringS::Format("A total of %u %.*ss have been notified of your assistance request.", messageCount, staff_word.size(), staff_word.ptr()));
}

19
src/Plugins/RenX/RenX.Core/RenX_BanDatabase.cpp

@ -62,7 +62,7 @@ void RenX::BanDatabase::process_data(Jupiter::DataBuffer &buffer, FILE *file, fp
// Read varData from buffer to entry
for (size_t varData_entries = buffer.pop<size_t>(); varData_entries != 0; --varData_entries)
entry->varData.set(buffer.pop<Jupiter::String_Strict, char>(), buffer.pop<Jupiter::String_Strict, char>());
entry->varData[buffer.pop<Jupiter::String_Strict, char>()] = buffer.pop<Jupiter::String_Strict, char>();
RenX::BanDatabase::entries.add(entry);
}
@ -153,13 +153,10 @@ void RenX::BanDatabase::write(RenX::BanDatabase::Entry *entry, FILE *file)
size_t varData_entries = entry->varData.size();
buffer.push(varData_entries);
auto write_varData_entry = [&buffer](Jupiter::HashTable::Bucket::Entry &in_entry)
{
buffer.push(in_entry.key);
buffer.push(in_entry.value);
};
entry->varData.callback(write_varData_entry);
for (auto& entry : entry->varData) {
buffer.push(entry.first);
buffer.push(entry.second);
}
// push buffer to file
buffer.push_to(file);
@ -189,7 +186,7 @@ void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo &player
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins();
for (size_t i = 0; i < xPlugins.size(); i++)
if (xPlugins.get(i)->RenX_OnBan(*server, player, pluginData))
entry->varData.set(xPlugins.get(i)->getName(), pluginData);
entry->varData[xPlugins.get(i)->getName()] = pluginData;
entries.add(entry);
RenX::BanDatabase::write(entry);
@ -239,7 +236,7 @@ uint8_t RenX::BanDatabase::getVersion() const
return RenX::BanDatabase::write_version;
}
const Jupiter::ReadableString &RenX::BanDatabase::getFileName() const
const std::string &RenX::BanDatabase::getFileName() const
{
return RenX::BanDatabase::filename;
}
@ -251,7 +248,7 @@ const Jupiter::ArrayList<RenX::BanDatabase::Entry> &RenX::BanDatabase::getEntrie
bool RenX::BanDatabase::initialize()
{
RenX::BanDatabase::filename = RenX::getCore()->getConfig().get("BanDB"_jrs, "Bans.db"_jrs);
RenX::BanDatabase::filename = static_cast<std::string>(RenX::getCore()->getConfig().get("BanDB"_jrs, "Bans.db"_jrs));
return this->process_file(filename);
}

10
src/Plugins/RenX/RenX.Core/RenX_BanDatabase.h

@ -20,9 +20,9 @@
#define _RENX_BANDATABASE_H_HEADER
#include <cstdint>
#include <unordered_map>
#include "Jupiter/Database.h"
#include "Jupiter/String.hpp"
#include "Jupiter/CString.h"
#include "Jupiter/ArrayList.h"
#include "RenX.h"
@ -79,6 +79,8 @@ namespace RenX
*/
struct RENX_API Entry
{
using VarDataTableType = std::unordered_map<Jupiter::StringS, Jupiter::StringS, Jupiter::default_hash_function>;
fpos_t pos; /** Position of the entry in the database */
uint16_t flags /** Flags affecting this ban entry (See below for flags) */ = 0x00;
std::chrono::system_clock::time_point timestamp /** Time the ban was created */;
@ -91,7 +93,7 @@ namespace RenX
Jupiter::StringS name /** Name of the banned player */;
Jupiter::StringS banner /** Name of the user who initiated the ban */;
Jupiter::StringS reason /** Reason the player was banned */;
Jupiter::HashTable varData; /** Variable entry data */
VarDataTableType varData; /** Variable entry data */
static const uint16_t FLAG_ACTIVE = 0x8000U;
static const uint16_t FLAG_USE_RDNS = 0x4000U;
@ -199,7 +201,7 @@ namespace RenX
*
* @return Database file name
*/
const Jupiter::ReadableString &getFileName() const;
const std::string &getFileName() const;
/**
* @brief Fetches the list of ban entries.
@ -217,7 +219,7 @@ namespace RenX
uint8_t read_version = write_version;
fpos_t eof;
Jupiter::CStringS filename;
std::string filename;
Jupiter::ArrayList<RenX::BanDatabase::Entry> entries;
};

2
src/Plugins/RenX/RenX.Core/RenX_Core.cpp

@ -58,7 +58,7 @@ bool RenX::Core::initialize()
if (server->connect() == false)
{
fprintf(stderr, "[RenX] ERROR: Failed to connect to %.*s on port %u. Error code: %d" ENDL, server->getHostname().size(), server->getHostname().ptr(), server->getPort(), Jupiter::Socket::getLastError());
fprintf(stderr, "[RenX] ERROR: Failed to connect to %.*s on port %u. Error code: %d" ENDL, server->getHostname().size(), server->getHostname().c_str(), server->getPort(), Jupiter::Socket::getLastError());
delete server;
}
else RenX::Core::addServer(server);

4
src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.cpp

@ -174,7 +174,7 @@ uint8_t RenX::ExemptionDatabase::getVersion() const
return RenX::ExemptionDatabase::write_version;
}
const Jupiter::ReadableString &RenX::ExemptionDatabase::getFileName() const
const std::string &RenX::ExemptionDatabase::getFileName() const
{
return RenX::ExemptionDatabase::filename;
}
@ -186,7 +186,7 @@ const Jupiter::ArrayList<RenX::ExemptionDatabase::Entry> &RenX::ExemptionDatabas
bool RenX::ExemptionDatabase::initialize()
{
RenX::ExemptionDatabase::filename = RenX::getCore()->getConfig().get("ExemptionDB"_jrs, "Exemptions.db"_jrs);
RenX::ExemptionDatabase::filename = static_cast<std::string>(RenX::getCore()->getConfig().get("ExemptionDB"_jrs, "Exemptions.db"_jrs));
return this->process_file(filename);
}

5
src/Plugins/RenX/RenX.Core/RenX_ExemptionDatabase.h

@ -23,7 +23,6 @@
#include <chrono>
#include "Jupiter/Database.h"
#include "Jupiter/String.hpp"
#include "Jupiter/CString.h"
#include "Jupiter/ArrayList.h"
#include "RenX.h"
@ -173,7 +172,7 @@ namespace RenX
*
* @return Database file name
*/
const Jupiter::ReadableString &getFileName() const;
const std::string &getFileName() const;
/**
* @brief Fetches the list of exemption entries.
@ -191,7 +190,7 @@ namespace RenX
uint8_t read_version = write_version;
fpos_t eof;
Jupiter::CStringS filename;
std::string filename;
Jupiter::ArrayList<RenX::ExemptionDatabase::Entry> entries;
};

2
src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.cpp

@ -321,7 +321,7 @@ void RenX::LadderDatabase::append(RenX::LadderDatabase::Entry *entry)
RenX::LadderDatabase::end = entry;
}
void RenX::LadderDatabase::write(const Jupiter::CStringType &filename)
void RenX::LadderDatabase::write(const std::string &filename)
{
return RenX::LadderDatabase::write(filename.c_str());
}

2
src/Plugins/RenX/RenX.Core/RenX_LadderDatabase.h

@ -162,7 +162,7 @@ namespace RenX
/**
* @brief Writes the current ladder data to the disk.
*/
void write(const Jupiter::CStringType &filename);
void write(const std::string &filename);
void write(const char *filename);
/**

237
src/Plugins/RenX/RenX.Core/RenX_Server.cpp

@ -109,7 +109,7 @@ int RenX::Server::think()
}
}
}
else if (Jupiter::Socket::getLastError() == 10035) // Operation would block (no new data)
else if (Jupiter::Socket::getLastError() == JUPITER_SOCK_EWOULDBLOCK) // Operation would block (no new data)
{
cycle_player_rdns();
@ -159,22 +159,27 @@ int RenX::Server::think()
int RenX::Server::OnRehash()
{
Jupiter::StringS oldHostname = RenX::Server::hostname;
Jupiter::StringS oldClientHostname = RenX::Server::clientHostname;
std::string oldHostname = RenX::Server::hostname;
std::string oldClientHostname = RenX::Server::clientHostname;
Jupiter::StringS oldPass = RenX::Server::pass;
unsigned short oldPort = RenX::Server::port;
int oldSteamFormat = RenX::Server::steamFormat;
RenX::Server::commands.emptyAndDelete();
RenX::Server::init(*RenX::getCore()->getConfig().getSection(RenX::Server::configSection));
if (RenX::Server::port == 0 || RenX::Server::hostname.isNotEmpty())
if (RenX::Server::port == 0 || !RenX::Server::hostname.empty())
{
RenX::Server::hostname = oldHostname;
RenX::Server::clientHostname = oldClientHostname;
RenX::Server::pass = oldPass;
RenX::Server::port = oldPort;
}
else if (oldHostname.equalsi(RenX::Server::hostname) == false || oldPort != RenX::Server::port || oldClientHostname.equalsi(RenX::Server::clientHostname) == false || oldPass.equalsi(RenX::Server::pass) == false)
else if (Jupiter::ReferenceString(oldHostname.c_str()).equalsi(RenX::Server::hostname) == false
|| oldPort != RenX::Server::port
|| Jupiter::ReferenceString(oldClientHostname.c_str()).equalsi(RenX::Server::clientHostname) == false
|| oldPass.equalsi(RenX::Server::pass) == false) {
RenX::Server::reconnect(RenX::DisconnectReason::Rehash);
}
return 0;
}
@ -626,28 +631,21 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
Jupiter::StringL user_message = Jupiter::StringL::Format(IRCCOLOR "04[Alert] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR " is marked for monitoring by %.*s for: \"%.*s\". Please keep an eye on them in ", fmtName.size(), fmtName.ptr(), last_to_expire[6]->banner.size(), last_to_expire[6]->banner.ptr(), last_to_expire[6]->reason.size(), last_to_expire[6]->reason.ptr());
Jupiter::StringS channel_message = Jupiter::StringS::Format(IRCCOLOR "04[Alert] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR " is marked for monitoring by %.*s for: \"%.*s\"." IRCCOLOR, fmtName.size(), fmtName.ptr(), last_to_expire[6]->banner.size(), last_to_expire[6]->banner.ptr(), last_to_expire[6]->reason.size(), last_to_expire[6]->reason.ptr());
auto alert_message_callback = [this, server, &user_message, &channel_message](Jupiter::IRC::Client::ChannelTableType::Bucket::Entry &in_entry)
{
auto alert_message_user_callback = [server, &in_entry, &user_message](Jupiter::IRC::Client::Channel::UserTableType::Bucket::Entry &in_user_entry)
{
if (in_entry.value.getUserPrefix(in_user_entry.value) != 0 && in_user_entry.value.getNickname().equals(server->getNickname()) == false)
server->sendMessage(in_user_entry.value.getUser()->getNickname(), user_message);
};
if (this->isAdminLogChanType(in_entry.value.getType()))
for (size_t server_index = 0; server_index < serverManager->size(); ++server_index) {
server = serverManager->getServer(server_index);
for (auto& channel : server->getChannels()) {
if (this->isAdminLogChanType(channel.second.getType()))
{
server->sendMessage(in_entry.value.getName(), channel_message);
server->sendMessage(channel.second.getName(), channel_message);
user_message += in_entry.value.getName();
in_entry.value.getUsers().callback(alert_message_user_callback);
user_message -= in_entry.value.getName().size();
user_message += channel.second.getName();
for (auto& user : channel.second.getUsers()) {
if (channel.second.getUserPrefix(user.second) != 0 && user.second.getNickname().equals(server->getNickname()) == false)
server->sendMessage(user.second.getUser()->getNickname(), user_message);
}
user_message -= channel.second.getName().size();
}
}
};
for (size_t server_index = 0; server_index < serverManager->size(); ++server_index)
{
server = serverManager->getServer(server_index);
server->getChannels().callback(alert_message_callback);
}
}
}
@ -953,7 +951,7 @@ const Jupiter::ReadableString &RenX::Server::getRules() const
return RenX::Server::rules;
}
const Jupiter::ReadableString &RenX::Server::getHostname() const
const std::string &RenX::Server::getHostname() const
{
return RenX::Server::hostname;
}
@ -963,7 +961,7 @@ unsigned short RenX::Server::getPort() const
return RenX::Server::port;
}
const Jupiter::ReadableString &RenX::Server::getSocketHostname() const
const std::string &RenX::Server::getSocketHostname() const
{
return RenX::Server::sock.getRemoteHostname();
}
@ -1334,7 +1332,7 @@ void RenX::Server::sendLogChan(const Jupiter::ReadableString &msg) const
void resolve_rdns(RenX::PlayerInfo *player)
{
player->rdns_mutex.lock();
char *resolved = Jupiter::Socket::resolveHostname_alloc(Jupiter::CStringS(player->ip).c_str(), 0);
char *resolved = Jupiter::Socket::resolveHostname_alloc(static_cast<std::string>(player->ip).c_str(), 0);
player->rdns.capture(resolved, strlen(resolved));
player->rdns_mutex.unlock();
}
@ -1456,7 +1454,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
player->name = name;
player->team = team;
player->ip = ip;
player->ip32 = Jupiter::Socket::pton4(Jupiter::CStringS(player->ip).c_str());
player->ip32 = Jupiter::Socket::pton4(static_cast<std::string>(player->ip).c_str());
player->hwid = hwid;
// RDNS
@ -1494,7 +1492,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (player->ip32 == 0 && ip.isNotEmpty())
{
player->ip = ip;
player->ip32 = Jupiter::Socket::pton4(Jupiter::CStringS(player->ip).c_str());
player->ip32 = Jupiter::Socket::pton4(static_cast<std::string>(player->ip).c_str());
if (this->resolvesRDNS())
{
player->rdns_thread = std::thread(resolve_rdns, player);
@ -1610,43 +1608,62 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
rPlayerLogKillsPlayerKillsBotKillsDeathsScoreCreditsCharacterBoundVehicleVehicleSpyRemoteC4ATMineKDRPingAdminSteamIPIDNameTeamTeamNum
rGDI,256,EKT-J000005217.9629Rx_FamilyInfo_GDI_SoldierFalse000.00008None0x0110000104AE0666127.0.0.1256EKT-JGDI0
*/
Jupiter::HashTable table;
std::unordered_map<Jupiter::StringS, Jupiter::StringS, Jupiter::default_hash_function> table;
size_t i = tokens.token_count;
while (i-- != 0)
table.set(this->commandListFormat.getToken(i), tokens.getToken(i));
auto parse = [&table](RenX::PlayerInfo *player)
table[this->commandListFormat.getToken(i)] = tokens.getToken(i);
auto table_get = [&table](const Jupiter::ReadableString& in_key) -> Jupiter::StringS* {
auto value = table.find(in_key);
if (value != table.end()) {
return &value->second;
}
return nullptr;
};
auto table_get_ref = [&table](const Jupiter::ReadableString& in_key, const Jupiter::ReadableString& in_default_value) -> const Jupiter::ReadableString& {
auto value = table.find(in_key);
if (value != table.end()) {
return value->second;
}
return in_default_value;
};
auto parse = [&table_get](RenX::PlayerInfo *player)
{
Jupiter::ReadableString *value;
value = table.get("KILLS"_jrs);
value = table_get("KILLS"_jrs);
if (value != nullptr)
player->kills = value->asUnsignedInt();
value = table.get("DEATHS"_jrs);
value = table_get("DEATHS"_jrs);
if (value != nullptr)
player->deaths = value->asUnsignedInt();
value = table.get("SCORE"_jrs);
value = table_get("SCORE"_jrs);
if (value != nullptr)
player->score = value->asDouble();
value = table.get("CREDITS"_jrs);
value = table_get("CREDITS"_jrs);
if (value != nullptr)
player->credits = value->asDouble();
value = table.get("CHARACTER"_jrs);
value = table_get("CHARACTER"_jrs);
if (value != nullptr)
player->character = *value;
value = table.get("VEHICLE"_jrs);
value = table_get("VEHICLE"_jrs);
if (value != nullptr)
player->vehicle = *value;
value = table.get("PING"_jrs);
value = table_get("PING"_jrs);
if (value != nullptr)
player->ping = value->asUnsignedInt();
value = table.get("ADMIN"_jrs);
value = table_get("ADMIN"_jrs);
if (value != nullptr)
{
if (value->equals("None"_jrs))
@ -1655,13 +1672,13 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
player->adminType = *value;
}
};
Jupiter::ReadableString *value = table.get("PLAYERLOG"_jrs);
Jupiter::ReadableString *value = table_get("PLAYERLOG"_jrs);
if (value != nullptr)
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(*value, 2, ','), Jupiter::ReferenceString::getToken(*value, 1, ',').asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(*value, 0, ',')), false, table.get("STEAM"_jrs, Jupiter::ReferenceString::empty).asUnsignedLongLong(), table.get("IP"_jrs, Jupiter::ReferenceString::empty), table.get("HWID"_jrs, Jupiter::ReferenceString::empty)));
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(*value, 2, ','), Jupiter::ReferenceString::getToken(*value, 1, ',').asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(*value, 0, ',')), false, table_get_ref("STEAM"_jrs, Jupiter::ReferenceString::empty).asUnsignedLongLong(), table_get_ref("IP"_jrs, Jupiter::ReferenceString::empty), table_get_ref("HWID"_jrs, Jupiter::ReferenceString::empty)));
else
{
Jupiter::ReadableString *name = table.get("NAME"_jrs);
value = table.get("ID"_jrs);
Jupiter::ReadableString *name = table_get("NAME"_jrs);
value = table_get("ID"_jrs);
if (value != nullptr)
{
@ -1670,16 +1687,16 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{
if (player->name.isEmpty())
{
player->name = table.get("NAME"_jrs, Jupiter::ReferenceString::empty);
player->name = table_get_ref("NAME"_jrs, Jupiter::ReferenceString::empty);
player->name.processEscapeSequences();
}
if (player->ip.isEmpty())
player->ip = table.get("IP"_jrs, Jupiter::ReferenceString::empty);
player->ip = table_get_ref("IP"_jrs, Jupiter::ReferenceString::empty);
if (player->hwid.isEmpty())
player->hwid = table.get("HWID"_jrs, Jupiter::ReferenceString::empty);
player->hwid = table_get_ref("HWID"_jrs, Jupiter::ReferenceString::empty);
if (player->steamid == 0)
{
uint64_t steamid = table.get("STEAM"_jrs, Jupiter::ReferenceString::empty).asUnsignedLongLong();
uint64_t steamid = table_get_ref("STEAM"_jrs, Jupiter::ReferenceString::empty).asUnsignedLongLong();
if (steamid != 0)
{
player->steamid = steamid;
@ -1687,12 +1704,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
}
}
value = table.get("TEAMNUM"_jrs);
value = table_get("TEAMNUM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(value->asInt());
else
{
value = table.get("TEAM"_jrs);
value = table_get("TEAM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(*value);
}
@ -1708,12 +1725,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (player != nullptr)
{
if (player->ip.isEmpty())
player->ip = table.get("IP"_jrs, Jupiter::ReferenceString::empty);
player->ip = table_get_ref("IP"_jrs, Jupiter::ReferenceString::empty);
if (player->hwid.isEmpty())
player->hwid = table.get("HWID"_jrs, Jupiter::ReferenceString::empty);
player->hwid = table_get_ref("HWID"_jrs, Jupiter::ReferenceString::empty);
if (player->steamid == 0)
{
uint64_t steamid = table.get("STEAM"_jrs, Jupiter::ReferenceString::empty).asUnsignedLongLong();
uint64_t steamid = table_get_ref("STEAM"_jrs, Jupiter::ReferenceString::empty).asUnsignedLongLong();
if (steamid != 0)
{
player->steamid = steamid;
@ -1721,12 +1738,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
}
}
value = table.get("TEAMNUM"_jrs);
value = table_get("TEAMNUM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(value->asInt());
else
{
value = table.get("TEAM"_jrs);
value = table_get("TEAM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(*value);
}
@ -1757,45 +1774,64 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
rPlayerLogKillsPlayerKillsBotKillsDeathsScoreCreditsCharacterBoundVehicleVehicleSpyRemoteC4ATMineKDRPingAdminSteamIPIDNameTeamTeamNum
rGDI,256,EKT-J000005217.9629Rx_FamilyInfo_GDI_SoldierFalse000.00008None0x0110000104AE0666127.0.0.1256EKT-JGDI0
*/
Jupiter::HashTable table;
std::unordered_map<Jupiter::StringS, Jupiter::StringS, Jupiter::default_hash_function> table;
size_t i = tokens.token_count;
while (i-- != 0)
table.set(this->commandListFormat.getToken(i), tokens.getToken(i));
auto parse = [&table](RenX::PlayerInfo *player)
table[this->commandListFormat.getToken(i)] = tokens.getToken(i);
auto table_get = [&table](const Jupiter::ReadableString& in_key) -> Jupiter::StringS* {
auto value = table.find(in_key);
if (value != table.end()) {
return &value->second;
}
return nullptr;
};
auto table_get_ref = [&table](const Jupiter::ReadableString& in_key, const Jupiter::ReadableString& in_default_value) -> const Jupiter::ReadableString& {
auto value = table.find(in_key);
if (value != table.end()) {
return value->second;
}
return in_default_value;
};
auto parse = [&table_get](RenX::PlayerInfo *player)
{
Jupiter::ReadableString *value;
value = table.get("KILLS"_jrs);
value = table_get("KILLS"_jrs);
if (value != nullptr)
player->kills = value->asUnsignedInt();
value = table.get("DEATHS"_jrs);
value = table_get("DEATHS"_jrs);
if (value != nullptr)
player->deaths = value->asUnsignedInt();
value = table.get("SCORE"_jrs);
value = table_get("SCORE"_jrs);
if (value != nullptr)
player->score = value->asDouble();
value = table.get("CREDITS"_jrs);
value = table_get("CREDITS"_jrs);
if (value != nullptr)
player->credits = value->asDouble();
value = table.get("CHARACTER"_jrs);
value = table_get("CHARACTER"_jrs);
if (value != nullptr)
player->character = *value;
value = table.get("VEHICLE"_jrs);
value = table_get("VEHICLE"_jrs);
if (value != nullptr)
player->vehicle = *value;
};
Jupiter::ReadableString *value = table.get("PLAYERLOG"_jrs);
Jupiter::ReadableString *value = table_get("PLAYERLOG"_jrs);
if (value != nullptr)
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(*value, 2, ','), Jupiter::ReferenceString::getToken(*value, 1, ',').substring(1).asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(*value, 0, ',')), true, 0ULL, Jupiter::ReferenceString::empty, Jupiter::ReferenceString::empty));
else
{
Jupiter::ReadableString *name = table.get("NAME"_jrs);
value = table.get("ID"_jrs);
Jupiter::ReadableString *name = table_get("NAME"_jrs);
value = table_get("ID"_jrs);
if (value != nullptr)
{
@ -1804,16 +1840,16 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{
if (player->name.isEmpty())
{
player->name = table.get("NAME"_jrs, Jupiter::ReferenceString::empty);
player->name = table_get_ref("NAME"_jrs, Jupiter::ReferenceString::empty);
player->name.processEscapeSequences();
}
value = table.get("TEAMNUM"_jrs);
value = table_get("TEAMNUM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(value->asInt());
else
{
value = table.get("TEAM"_jrs);
value = table_get("TEAM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(*value);
}
@ -1826,12 +1862,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
RenX::PlayerInfo *player = getPlayerByName(*name);
if (player != nullptr)
{
value = table.get("TEAMNUM"_jrs);
value = table_get("TEAMNUM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(value->asInt());
else
{
value = table.get("TEAM"_jrs);
value = table_get("TEAM"_jrs);
if (value != nullptr)
player->team = RenX::getTeam(*value);
}
@ -1854,15 +1890,24 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
rBuildingHealthMaxHealthArmor MaxArmor TeamCapturable Destroyed
rRx_Building_Refinery_GDI200020002000 2000 GDIFalse False
*/
Jupiter::HashTable table;
std::unordered_map<Jupiter::StringS, Jupiter::StringS, Jupiter::default_hash_function> table;
size_t i = tokens.token_count;
while (i-- != 0)
table.set(this->commandListFormat.getToken(i), tokens.getToken(i));
table[this->commandListFormat.getToken(i)] = tokens.getToken(i);
auto table_get = [&table](const Jupiter::ReadableString& in_key) -> Jupiter::StringS* {
auto value = table.find(in_key);
if (value != table.end()) {
return &value->second;
}
return nullptr;
};
Jupiter::ReadableString *value;
RenX::BuildingInfo *building;
value = table.get("Building"_jrs);
value = table_get("Building"_jrs);
if (value != nullptr)
{
building = this->getBuildingByName(*value);
@ -1873,31 +1918,31 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
building->name = *value;
}
value = table.get("Health"_jrs);
value = table_get("Health"_jrs);
if (value != nullptr)
building->health = value->asInt(10);
value = table.get("MaxHealth"_jrs);
value = table_get("MaxHealth"_jrs);
if (value != nullptr)
building->max_health = value->asInt(10);
value = table.get("Team"_jrs);
value = table_get("Team"_jrs);
if (value != nullptr)
building->team = RenX::getTeam(*value);
value = table.get("Capturable"_jrs);
value = table_get("Capturable"_jrs);
if (value != nullptr)
building->capturable = value->asBool();
value = table.get("Destroyed"_jrs);
value = table_get("Destroyed"_jrs);
if (value != nullptr)
building->destroyed = value->asBool();
value = table.get("Armor"_jrs);
value = table_get("Armor"_jrs);
if (value != nullptr)
building->armor = value->asInt(10);
value = table.get("MaxArmor"_jrs);
value = table_get("MaxArmor"_jrs);
if (value != nullptr)
building->max_armor = value->asInt(10);
}
@ -3379,7 +3424,7 @@ void RenX::Server::disconnect(RenX::DisconnectReason reason)
bool RenX::Server::connect()
{
RenX::Server::lastAttempt = std::chrono::steady_clock::now();
if (RenX::Server::sock.connect(RenX::Server::hostname.c_str(), RenX::Server::port, RenX::Server::clientHostname.isEmpty() ? nullptr : RenX::Server::clientHostname.c_str()))
if (RenX::Server::sock.connect(RenX::Server::hostname.c_str(), RenX::Server::port, RenX::Server::clientHostname.empty() ? nullptr : RenX::Server::clientHostname.c_str()))
{
RenX::Server::sock.setBlocking(false);
RenX::Server::sock.send(Jupiter::StringS::Format("a%.*s\n", RenX::Server::pass.size(), RenX::Server::pass.ptr()));
@ -3478,9 +3523,9 @@ RenX::Server::Server(const Jupiter::ReadableString &configurationSection)
void RenX::Server::init(const Jupiter::Config &config)
{
RenX::Server::hostname = config.get("Hostname"_jrs, "localhost"_jrs);
RenX::Server::hostname = static_cast<std::string>(config.get("Hostname"_jrs, "localhost"_jrs));
RenX::Server::port = config.get<unsigned short>("Port"_jrs, 7777);
RenX::Server::clientHostname = config.get("ClientAddress"_jrs);
RenX::Server::clientHostname = static_cast<std::string>(config.get("ClientAddress"_jrs));
RenX::Server::pass = config.get("Password"_jrs, "renx"_jrs);
RenX::Server::logChanType = config.get<int>("ChanType"_jrs);
@ -3522,22 +3567,12 @@ void RenX::Server::init(const Jupiter::Config &config)
{
Jupiter::Config *basic_commands_help = commandsFile.getSection(section_prefix + ".Basic.Help"_jrs);
auto basic_command_no_help_callback = [this](Jupiter::HashTable::Bucket::Entry &in_entry)
{
if (this->getCommand(in_entry.key) == nullptr)
this->addCommand(new RenX::BasicGameCommand(in_entry.key, in_entry.value, ""_jrs));
};
auto basic_command_callback = [this, basic_commands_help](Jupiter::HashTable::Bucket::Entry &in_entry)
{
if (this->getCommand(in_entry.key) == nullptr)
this->addCommand(new RenX::BasicGameCommand(in_entry.key, in_entry.value, basic_commands_help->get(in_entry.value, ""_jrs)));
};
if (basic_commands_help == nullptr)
basic_commands->getTable().callback(basic_command_no_help_callback);
else
basic_commands->getTable().callback(basic_command_callback);
for (auto& command : basic_commands->getTable()) {
if (this->getCommand(command.first) == nullptr) {
const auto& help_str = basic_commands_help == nullptr ? ""_jrs : basic_commands_help->get(command.second, ""_jrs);
this->addCommand(new RenX::BasicGameCommand(command.first, command.second,help_str));
}
}
}
};

9
src/Plugins/RenX/RenX.Core/RenX_Server.h

@ -29,7 +29,6 @@
#include "Jupiter/TCPSocket.h"
#include "Jupiter/ArrayList.h"
#include "Jupiter/String.hpp"
#include "Jupiter/CString.h"
#include "Jupiter/Config.h"
#include "Jupiter/Thinker.h"
#include "Jupiter/Rehash.h"
@ -699,7 +698,7 @@ namespace RenX
*
* @return String containing the hostname of the server.
*/
const Jupiter::ReadableString &getHostname() const;
const std::string &getHostname() const;
/**
* @brief Fetches the port of a server.
@ -713,7 +712,7 @@ namespace RenX
*
* @return String containing the hostname of the server.
*/
const Jupiter::ReadableString &getSocketHostname() const;
const std::string &getSocketHostname() const;
/**
* @brief Fetches the port from the server socket.
@ -1082,8 +1081,8 @@ namespace RenX
std::chrono::milliseconds buildingUpdateRate;
std::chrono::milliseconds pingRate;
std::chrono::milliseconds pingTimeoutThreshold;
Jupiter::CStringS clientHostname;
Jupiter::CStringS hostname;
std::string clientHostname;
std::string hostname;
Jupiter::StringS pass;
Jupiter::StringS configSection;
Jupiter::StringS rules;

8
src/Plugins/RenX/RenX.Core/RenX_Tags.cpp

@ -58,8 +58,8 @@ bool TagsImp::initialize()
TagsImp::bar_width = config[configSection].get<int>("BarWidth"_jrs, 19);
/** Global formats */
this->dateFmt = config[configSection].get("DateFormat"_jrs, "%A, %B %d, %Y"_jrs);
this->timeFmt = config[configSection].get("TimeFormat"_jrs, "%H:%M:%S"_jrs);;
this->dateFmt = static_cast<std::string>(config[configSection].get("DateFormat"_jrs, "%A, %B %d, %Y"_jrs));
this->timeFmt = static_cast<std::string>(config[configSection].get("TimeFormat"_jrs, "%H:%M:%S"_jrs));
/** Internal message tags */
@ -457,9 +457,9 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
PROCESS_TAG(this->INTERNAL_SERVER_NAME_TAG, server->getName());
PROCESS_TAG(this->INTERNAL_MAP_TAG, server->getMap().name);
PROCESS_TAG(this->INTERNAL_MAP_GUID_TAG, RenX::formatGUID(server->getMap()));
PROCESS_TAG(this->INTERNAL_SERVER_HOSTNAME_TAG, server->getHostname());
PROCESS_TAG(this->INTERNAL_SERVER_HOSTNAME_TAG, Jupiter::ReferenceString(server->getHostname().c_str()));
PROCESS_TAG(this->INTERNAL_SERVER_PORT_TAG, Jupiter::StringS::Format("%u", server->getPort()));
PROCESS_TAG(this->INTERNAL_SOCKET_HOSTNAME_TAG, server->getSocketHostname());
PROCESS_TAG(this->INTERNAL_SOCKET_HOSTNAME_TAG, Jupiter::ReferenceString(server->getSocketHostname().c_str()));
PROCESS_TAG(this->INTERNAL_SOCKET_PORT_TAG, Jupiter::StringS::Format("%u", server->getSocketPort()));
PROCESS_TAG(this->INTERNAL_SERVER_PREFIX_TAG, server->getPrefix());
if (player != nullptr)

5
src/Plugins/RenX/RenX.Core/RenX_Tags.h

@ -25,7 +25,6 @@
*/
#include "Jupiter/String.hpp"
#include "Jupiter/CString.h"
#include "RenX.h"
#include "RenX_LadderDatabase.h"
@ -52,8 +51,8 @@ namespace RenX
virtual bool initialize();
/** Global formats */
Jupiter::CStringS dateFmt;
Jupiter::CStringS timeFmt;
std::string dateFmt;
std::string timeFmt;
/** Global tags */
Jupiter::StringS INTERNAL_DATE_TAG;

4
src/Plugins/RenX/RenX.ExtraLogging/RenX_ExtraLogging.cpp

@ -51,13 +51,13 @@ bool RenX_ExtraLoggingPlugin::initialize()
RenX_ExtraLoggingPlugin::consolePrefix = this->config.get("ConsolePrefix"_jrs, RenX_ExtraLoggingPlugin::filePrefix);
RenX_ExtraLoggingPlugin::newDayFmt = this->config.get("NewDayFormat"_jrs, Jupiter::StringS::Format("Time: %.*s %.*s", RenX::tags->timeTag.size(), RenX::tags->timeTag.ptr(), RenX::tags->dateTag.size(), RenX::tags->dateTag.ptr()));
RenX_ExtraLoggingPlugin::printToConsole = this->config.get<bool>("PrintToConsole"_jrs, true);
const Jupiter::CStringS logFile = this->config.get("LogFile"_jrs);
const std::string logFile = static_cast<std::string>(this->config.get("LogFile"_jrs));
RenX::sanitizeTags(RenX_ExtraLoggingPlugin::filePrefix);
RenX::sanitizeTags(RenX_ExtraLoggingPlugin::consolePrefix);
RenX::sanitizeTags(RenX_ExtraLoggingPlugin::newDayFmt);
if (logFile.isNotEmpty())
if (!logFile.empty())
{
RenX_ExtraLoggingPlugin::file = fopen(logFile.c_str(), "a+b");
if (RenX_ExtraLoggingPlugin::file != nullptr && RenX_ExtraLoggingPlugin::newDayFmt.isNotEmpty())

60
src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.cpp

@ -72,11 +72,11 @@ void RenX_Ladder_WebPlugin::init()
FILE *file;
int chr;
RenX_Ladder_WebPlugin::web_header_filename = this->config.get("HeaderFilename"_jrs, "RenX.Ladder.Web.Header.html"_jrs);
RenX_Ladder_WebPlugin::web_footer_filename = this->config.get("FooterFilename"_jrs, "RenX.Ladder.Web.Footer.html"_jrs);
RenX_Ladder_WebPlugin::web_profile_filename = this->config.get("ProfileFilename"_jrs, "RenX.Ladder.Web.Profile.html"_jrs);
RenX_Ladder_WebPlugin::web_ladder_table_header_filename = this->config.get("LadderTableHeaderFilename"_jrs, "RenX.Ladder.Web.Ladder.Table.Header.html"_jrs);
RenX_Ladder_WebPlugin::web_ladder_table_footer_filename = this->config.get("LadderTableFooterFilename"_jrs, "RenX.Ladder.Web.Ladder.Table.Footer.html"_jrs);
RenX_Ladder_WebPlugin::web_header_filename = static_cast<std::string>(this->config.get("HeaderFilename"_jrs, "RenX.Ladder.Web.Header.html"_jrs));
RenX_Ladder_WebPlugin::web_footer_filename = static_cast<std::string>(this->config.get("FooterFilename"_jrs, "RenX.Ladder.Web.Footer.html"_jrs));
RenX_Ladder_WebPlugin::web_profile_filename = static_cast<std::string>(this->config.get("ProfileFilename"_jrs, "RenX.Ladder.Web.Profile.html"_jrs));
RenX_Ladder_WebPlugin::web_ladder_table_header_filename = static_cast<std::string>(this->config.get("LadderTableHeaderFilename"_jrs, "RenX.Ladder.Web.Ladder.Table.Header.html"_jrs));
RenX_Ladder_WebPlugin::web_ladder_table_footer_filename = static_cast<std::string>(this->config.get("LadderTableFooterFilename"_jrs, "RenX.Ladder.Web.Ladder.Table.Footer.html"_jrs));
RenX_Ladder_WebPlugin::entries_per_page = this->config.get<size_t>("EntriesPerPage"_jrs, 50);
RenX_Ladder_WebPlugin::min_search_name_length = this->config.get<size_t>("MinSearchNameLength"_jrs, 3);
@ -95,7 +95,7 @@ void RenX_Ladder_WebPlugin::init()
RenX_Ladder_WebPlugin::ladder_table_footer.erase();
/** Load header */
if (RenX_Ladder_WebPlugin::web_header_filename.isNotEmpty())
if (!RenX_Ladder_WebPlugin::web_header_filename.empty())
{
file = fopen(RenX_Ladder_WebPlugin::web_header_filename.c_str(), "rb");
if (file != nullptr)
@ -107,7 +107,7 @@ void RenX_Ladder_WebPlugin::init()
}
/** Load footer */
if (RenX_Ladder_WebPlugin::web_footer_filename.isNotEmpty())
if (!RenX_Ladder_WebPlugin::web_footer_filename.empty())
{
file = fopen(RenX_Ladder_WebPlugin::web_footer_filename.c_str(), "rb");
if (file != nullptr)
@ -119,7 +119,7 @@ void RenX_Ladder_WebPlugin::init()
}
/** Load profile */
if (RenX_Ladder_WebPlugin::web_profile_filename.isNotEmpty())
if (!RenX_Ladder_WebPlugin::web_profile_filename.empty())
{
file = fopen(RenX_Ladder_WebPlugin::web_profile_filename.c_str(), "rb");
if (file != nullptr)
@ -132,7 +132,7 @@ void RenX_Ladder_WebPlugin::init()
}
/** Load table header */
if (RenX_Ladder_WebPlugin::web_ladder_table_header_filename.isNotEmpty())
if (!RenX_Ladder_WebPlugin::web_ladder_table_header_filename.empty())
{
file = fopen(RenX_Ladder_WebPlugin::web_ladder_table_header_filename.c_str(), "rb");
if (file != nullptr)
@ -144,7 +144,7 @@ void RenX_Ladder_WebPlugin::init()
}
/** Load table footer */
if (RenX_Ladder_WebPlugin::web_ladder_table_footer_filename.isNotEmpty())
if (!RenX_Ladder_WebPlugin::web_ladder_table_footer_filename.empty())
{
file = fopen(RenX_Ladder_WebPlugin::web_ladder_table_footer_filename.c_str(), "rb");
if (file != nullptr)
@ -184,7 +184,7 @@ Jupiter::String generate_search(RenX::LadderDatabase *db)
}
/** Database selector */
Jupiter::String generate_database_selector(RenX::LadderDatabase *db, const Jupiter::HashTable &query_params)
Jupiter::String generate_database_selector(RenX::LadderDatabase *db, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params)
{
RenX::LadderDatabase *db_ptr;
Jupiter::String result(256);
@ -215,11 +215,11 @@ Jupiter::String generate_database_selector(RenX::LadderDatabase *db, const Jupit
}
}
const Jupiter::ReadableString *value = query_params.get("id"_jrs);
if (value != nullptr)
auto value = query_params.find("id"_jrs);
if (value != query_params.end())
{
result += R"html(<input type="hidden" name="id" value=")html"_jrs;
result += *value;
result += value->second;
result += R"html("/>)html"_jrs;
}
@ -309,7 +309,7 @@ Jupiter::String RenX_Ladder_WebPlugin::generate_entry_table(RenX::LadderDatabase
return result;
}
Jupiter::String *RenX_Ladder_WebPlugin::generate_ladder_page(RenX::LadderDatabase *db, uint8_t format, size_t index, size_t count, const Jupiter::HashTable &query_params)
Jupiter::String *RenX_Ladder_WebPlugin::generate_ladder_page(RenX::LadderDatabase *db, uint8_t format, size_t index, size_t count, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params)
{
Jupiter::String *result = new Jupiter::String(2048);
@ -334,7 +334,7 @@ Jupiter::String *RenX_Ladder_WebPlugin::generate_ladder_page(RenX::LadderDatabas
// include_header | include_footer | include_any_headers | include_any_footers
/** Search page */
Jupiter::String *RenX_Ladder_WebPlugin::generate_search_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::ReadableString &name, const Jupiter::HashTable &query_params)
Jupiter::String *RenX_Ladder_WebPlugin::generate_search_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::ReadableString &name, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params)
{
Jupiter::String *result = new Jupiter::String(2048);
@ -385,7 +385,7 @@ Jupiter::String *RenX_Ladder_WebPlugin::generate_search_page(RenX::LadderDatabas
}
/** Profile page */
Jupiter::String *RenX_Ladder_WebPlugin::generate_profile_page(RenX::LadderDatabase *db, uint8_t format, uint64_t steam_id, const Jupiter::HashTable &query_params)
Jupiter::String *RenX_Ladder_WebPlugin::generate_profile_page(RenX::LadderDatabase *db, uint8_t format, uint64_t steam_id, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params)
{
Jupiter::String *result = new Jupiter::String(2048);
@ -452,7 +452,7 @@ Jupiter::String *RenX_Ladder_WebPlugin::generate_profile_page(RenX::LadderDataba
/** Content functions */
Jupiter::ReadableString *generate_no_db_page(const Jupiter::HashTable &query_params)
Jupiter::ReadableString *generate_no_db_page(const Jupiter::HTTP::HTMLFormResponse::TableType &query_params)
{
Jupiter::String *result = new Jupiter::String(pluginInstance.header);
if (RenX::ladder_databases.size() != 0)
@ -476,11 +476,11 @@ Jupiter::ReadableString *handle_ladder_page(const Jupiter::ReadableString &query
if (html_form_response.table.size() != 0)
{
format = html_form_response.table.getCast<uint8_t>("format"_jrs, format);
start_index = html_form_response.table.getCast<size_t>("start"_jrs, start_index);
count = html_form_response.table.getCast<size_t>("count"_jrs, count);
format = html_form_response.tableGetCast<uint8_t>("format"_jrs, format);
start_index = html_form_response.tableGetCast<size_t>("start"_jrs, start_index);
count = html_form_response.tableGetCast<size_t>("count"_jrs, count);
const Jupiter::ReadableString &db_name = html_form_response.table.get("database"_jrs, Jupiter::ReferenceString::empty);
const Jupiter::ReadableString &db_name = html_form_response.tableGet("database"_jrs, Jupiter::ReferenceString::empty);
if (db_name.isNotEmpty())
{
db = nullptr;
@ -509,12 +509,12 @@ Jupiter::ReadableString *handle_search_page(const Jupiter::ReadableString &query
if (html_form_response.table.size() != 0)
{
format = html_form_response.table.getCast<uint8_t>("format"_jrs, format);
start_index = html_form_response.table.getCast<size_t>("start"_jrs, start_index);
count = html_form_response.table.getCast<size_t>("count"_jrs, count);
name = html_form_response.table.get("name"_jrs, name);
format = html_form_response.tableGetCast<uint8_t>("format"_jrs, format);
start_index = html_form_response.tableGetCast<size_t>("start"_jrs, start_index);
count = html_form_response.tableGetCast<size_t>("count"_jrs, count);
name = html_form_response.tableGet("name"_jrs, name);
const Jupiter::ReadableString &db_name = html_form_response.table.get("database"_jrs, Jupiter::ReferenceString::empty);
const Jupiter::ReadableString &db_name = html_form_response.tableGet("database"_jrs, Jupiter::ReferenceString::empty);
if (db_name.isNotEmpty())
{
db = nullptr;
@ -545,10 +545,10 @@ Jupiter::ReadableString *handle_profile_page(const Jupiter::ReadableString &quer
if (html_form_response.table.size() != 0)
{
format = html_form_response.table.getCast<uint8_t>("format"_jrs, format);
steam_id = html_form_response.table.getCast<uint64_t>("id"_jrs, steam_id);
format = html_form_response.tableGetCast<uint8_t>("format"_jrs, format);
steam_id = html_form_response.tableGetCast<uint64_t>("id"_jrs, steam_id);
const Jupiter::ReadableString &db_name = html_form_response.table.get("database"_jrs, Jupiter::ReferenceString::empty);
const Jupiter::ReadableString &db_name = html_form_response.tableGet("database"_jrs, Jupiter::ReferenceString::empty);
if (db_name.isNotEmpty())
{
db = nullptr;

18
src/Plugins/RenX/RenX.Ladder.Web/RenX_Ladder_Web.h

@ -21,7 +21,7 @@
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "Jupiter/CString.h"
#include "Jupiter/String.hpp"
#include "RenX_Plugin.h"
class RenX_Ladder_WebPlugin : public RenX::Plugin
@ -39,9 +39,9 @@ public:
Jupiter::StringS header;
Jupiter::StringS footer;
Jupiter::String *generate_ladder_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::HashTable &query_params);
Jupiter::String *generate_search_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::ReadableString &name, const Jupiter::HashTable &query_params);
Jupiter::String *generate_profile_page(RenX::LadderDatabase *db, uint8_t format, uint64_t steam_id, const Jupiter::HashTable &query_params);
Jupiter::String *generate_ladder_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params);
Jupiter::String *generate_search_page(RenX::LadderDatabase *db, uint8_t format, size_t start_index, size_t count, const Jupiter::ReadableString &name, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params);
Jupiter::String *generate_profile_page(RenX::LadderDatabase *db, uint8_t format, uint64_t steam_id, const Jupiter::HTTP::HTMLFormResponse::TableType &query_params);
inline size_t getEntriesPerPage() const { return this->entries_per_page; }
inline size_t getMinSearchNameLength() const { return this->min_search_name_length; };
@ -60,11 +60,11 @@ private:
Jupiter::StringS ladder_page_name, search_page_name, profile_page_name, ladder_table_header, ladder_table_footer;
Jupiter::StringS web_hostname;
Jupiter::StringS web_path;
Jupiter::CStringS web_header_filename;
Jupiter::CStringS web_footer_filename;
Jupiter::CStringS web_profile_filename;
Jupiter::CStringS web_ladder_table_header_filename;
Jupiter::CStringS web_ladder_table_footer_filename;
std::string web_header_filename;
std::string web_footer_filename;
std::string web_profile_filename;
std::string web_ladder_table_header_filename;
std::string web_ladder_table_footer_filename;
Jupiter::StringS entry_table_row, entry_profile, entry_profile_previous, entry_profile_next;
};

9
src/Plugins/RenX/RenX.Listen/RenX_Listen.cpp

@ -17,7 +17,6 @@
*/
#include "Jupiter/IRC_Client.h"
#include "Jupiter/CString.h"
#include "RenX_Listen.h"
#include "RenX_Core.h"
#include "RenX_Server.h"
@ -35,7 +34,7 @@ bool RenX_ListenPlugin::initialize()
const Jupiter::ReadableString &address = this->config.get("Address"_jrs, "0.0.0.0"_jrs);
RenX_ListenPlugin::serverSection = this->config.get("ServerSection"_jrs, this->getName());
return RenX_ListenPlugin::socket.bind(Jupiter::CStringS(address).c_str(), port, true) && RenX_ListenPlugin::socket.setBlocking(false);
return RenX_ListenPlugin::socket.bind(static_cast<std::string>(address).c_str(), port, true) && RenX_ListenPlugin::socket.setBlocking(false);
}
int RenX_ListenPlugin::think()
@ -45,8 +44,8 @@ int RenX_ListenPlugin::think()
{
sock->setBlocking(false);
RenX::Server *server = new RenX::Server(std::move(*sock), RenX_ListenPlugin::serverSection);
printf("Incoming server connected from %.*s:%u" ENDL, server->getSocketHostname().size(), server->getSocketHostname().ptr(), server->getSocketPort());
server->sendLogChan("Incoming server connected from " IRCCOLOR "12%.*s:%u", server->getSocketHostname().size(), server->getSocketHostname().ptr(), server->getSocketPort());
printf("Incoming server connected from %.*s:%u" ENDL, server->getSocketHostname().size(), server->getSocketHostname().c_str(), server->getSocketPort());
server->sendLogChan("Incoming server connected from " IRCCOLOR "12%.*s:%u", server->getSocketHostname().size(), server->getSocketHostname().c_str(), server->getSocketPort());
RenX::getCore()->addServer(server);
delete sock;
}
@ -65,7 +64,7 @@ int RenX_ListenPlugin::OnRehash()
{
puts("Notice: The Renegade-X listening socket has been changed!");
RenX_ListenPlugin::socket.close();
return RenX_ListenPlugin::socket.bind(Jupiter::CStringS(address).c_str(), port, true) == false || RenX_ListenPlugin::socket.setBlocking(false) == false;
return RenX_ListenPlugin::socket.bind(static_cast<std::string>(address).c_str(), port, true) == false || RenX_ListenPlugin::socket.setBlocking(false) == false;
}
return 0;
}

2
src/Plugins/RenX/RenX.Medals/RenX_Medals.cpp

@ -322,7 +322,7 @@ void RecsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
{
unsigned int recs = section->get<unsigned int>("Recs"_jrs);
unsigned int noobs = section->get<unsigned int>("Noobs"_jrs);
source->sendMessage(*player, Jupiter::StringS::Format("[Archive] %.*s has %u and %u n00bs. Their worth: %d", section->getName().size(), section->getName().ptr(), recs, noobs, recs - noobs));
source->sendMessage(*player, Jupiter::StringS::Format("[Archive] %.*s has %u and %u n00bs. Their worth: %d", section->getName().size(), section->getName().c_str(), recs, noobs, recs - noobs));
}
}
else if (target->uuid.isEmpty())

25
src/Plugins/RenX/RenX.ModSystem/RenX_ModSystem.cpp

@ -762,25 +762,17 @@ void DelIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &chan
source->sendNotice(nick, "Player has been removed from the moderator list."_jrs);
else
{
auto bucket_itr = pluginInstance.modsFile.getSections().begin();
auto bucket_end = pluginInstance.modsFile.getSections().end();
while (bucket_itr != bucket_end)
{
for (auto entry_itr = bucket_itr->m_entries.begin(); entry_itr != bucket_itr->m_entries.end(); ++entry_itr)
for (auto& section : pluginInstance.modsFile.getSections())
{
if (entry_itr->value.get("Name"_jrs).equalsi(parameters))
{
if (pluginInstance.modsFile.remove(entry_itr->key))
if (section.second.get("Name"_jrs).equalsi(parameters)) {
if (pluginInstance.modsFile.remove(section.first))
source->sendNotice(nick, "Player has been removed from the moderator list."_jrs);
else
source->sendNotice(nick, "Error: Unknown error occurred."_jrs);
bucket_itr = bucket_end;
return;
}
}
}
source->sendNotice(nick, "Error: Player not found."_jrs);
}
@ -896,16 +888,13 @@ void ModListIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
msg.aformat(IRCNORMAL " (Access: %d): ", node->access);
msgBaseSize = msg.size();
auto entry_callback = [&msg, &node](Jupiter::Config::SectionHashTable::Bucket::Entry &in_entry)
for (auto& section : pluginInstance.modsFile.getSections()) {
if (section.second.get("Group"_jrs).equalsi(node->name))
{
if (in_entry.value.get("Group"_jrs).equalsi(node->name))
{
msg += in_entry.value.get("Name"_jrs, in_entry.value.getName());
msg += section.second.get("Name"_jrs, section.second.getName());
msg += ", "_jrs;
}
};
pluginInstance.modsFile.getSections().callback(entry_callback);
}
if (msg.size() != msgBaseSize)
{

12
src/Plugins/RenX/RenX.ServerList/RenX_ServerList.cpp

@ -244,7 +244,7 @@ Jupiter::StringS server_as_json(const RenX::Server &server)
server.getCrateRespawnDelay(),
server.getTimeLimit(),
server.getPort(),
server.getSocketHostname().size(), server.getSocketHostname().ptr());
server.getSocketHostname().size(), server.getSocketHostname().c_str());
server_json_block += '}';
@ -282,7 +282,7 @@ Jupiter::StringS server_as_game(const RenX::Server &server)
server_game_block.format("\n<@>%.*s~%.*s~%u~%s~%.*s~" "%d;%d;%d;%s;%d;%d;%d;%s;%s;%s;%.*s;%s" "~%u~%d~%s~%s~%.*s",
server_name.size(), server_name.ptr(),
server.getSocketHostname().size(), server.getSocketHostname().ptr(),
server.getSocketHostname().size(), server.getSocketHostname().c_str(),
server.getPort(),
json_bool_as_cstring(server.isPassworded()),
server_map.size(), server_map.ptr(),
@ -360,7 +360,7 @@ Jupiter::StringS server_as_long_json(const RenX::Server &server)
server.getTimeLimit(),
server.getPort(),
server.getSocketHostname().size(), server.getSocketHostname().ptr());
server.getSocketHostname().size(), server.getSocketHostname().c_str());
// Level Rotation
@ -698,8 +698,8 @@ Jupiter::ReadableString *handle_server_page(const Jupiter::ReadableString &query
if (html_form_response.table.size() != 0)
{
address = html_form_response.table.get("ip"_jrs, address);
port = html_form_response.table.getCast<int>("port"_jrs, port);
address = html_form_response.tableGet("ip"_jrs, address);
port = html_form_response.tableGetCast<int>("port"_jrs, port);
}
// search for server
@ -712,7 +712,7 @@ Jupiter::ReadableString *handle_server_page(const Jupiter::ReadableString &query
return new Jupiter::ReferenceString();
server = servers.get(index);
if (server->getSocketHostname().equals(address) && server->getPort() == port)
if (address.equals(server->getSocketHostname()) && server->getPort() == port)
break;
++index;

Loading…
Cancel
Save