Browse Source

varData added to BanDatabase::Entry; Extra data is now read from the ban database.

pull/3/head
JustinAJ 10 years ago
parent
commit
645dc9473f
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 31
      RenX.Core/RenX_BanDatabase.cpp
  3. 1
      RenX.Core/RenX_BanDatabase.h

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

31
RenX.Core/RenX_BanDatabase.cpp

@ -37,6 +37,9 @@ bool RenX::BanDatabase::load(const Jupiter::ReadableString &fname)
while (!feof(file)) while (!feof(file))
if (fgetc(file) == '\n') if (fgetc(file) == '\n')
break; break;
Jupiter::String playerName(16);
Jupiter::String key(32);
Jupiter::String value(32);
Entry *entry; Entry *entry;
char c; char c;
while (!feof(file)) while (!feof(file))
@ -57,12 +60,36 @@ bool RenX::BanDatabase::load(const Jupiter::ReadableString &fname)
{ {
if (c == '\0') if (c == '\0')
{ {
// add plugin data. key.truncate(key.size());
value.truncate(value.size());
c = fgetc(file);
while (c != '\n' && c != EOF)
{
while (c != '\0')
{
key += c;
c = fgetc(file);
if (c == EOF)
{
fprintf(stderr, "ERROR: Unexpected EOF in %s at %lu", RenX::BanDatabase::filename.c_str(), ftell(file));
break;
}
}
c = fgetc(file);
while (c != '\n' && c != EOF)
{
value += c;
c = fgetc(file);
}
entry->varData.set(key, value);
c = fgetc(file);
}
break; break;
} }
entry->name += c; playerName += c;
c = fgetc(file); c = fgetc(file);
} }
entry->name = playerName;
entries.add(entry); entries.add(entry);
} }
fclose(file); fclose(file);

1
RenX.Core/RenX_BanDatabase.h

@ -52,6 +52,7 @@ namespace RenX
uint64_t steamid /** SteamID of the banned player */; uint64_t steamid /** SteamID of the banned player */;
uint32_t ip /** IPv4 address of the banned player */; uint32_t ip /** IPv4 address of the banned player */;
Jupiter::StringS name /** Name of the banned player */; Jupiter::StringS name /** Name of the banned player */;
Jupiter::INIFile::Section varData; /** Variable entry data */
}; };
/** /**

Loading…
Cancel
Save