Пример #1
0
void leagueOverSeer::loadConfig(const char* cmdLine) //Load the plugin configuration file
{
    PluginConfig config = PluginConfig(cmdLine);
    std::string section = "leagueOverSeer";

    if (config.errors) bz_shutdown(); //Shutdown the server

    //Extract all the data in the configuration file and assign it to plugin variables
    rotLeague = toBool(config.item(section, "ROTATIONAL_LEAGUE"));
    mapchangePath = config.item(section, "MAPCHANGE_PATH");
    SQLiteDB = config.item(section, "SQLITE_DB");
    LEAGUE_URL = config.item(section, "LEAGUE_OVER_SEER_URL");
    DEBUG = atoi((config.item(section, "DEBUG_LEVEL")).c_str());

    //Check for errors in the configuration data. If there is an error, shut down the server
    if (strcmp(LEAGUE_URL.c_str(), "") == 0)
    {
            bz_debugMessage(0, "*** DEBUG :: League Over Seer :: No URLs were choosen to report matches or query teams. ***");
            bz_shutdown();
    }
    if (DEBUG > 4 || DEBUG < 0)
    {
        bz_debugMessage(0, "*** DEBUG :: League Over Seer :: Invalid debug level in the configuration file. ***");
        bz_shutdown();
    }
}
Пример #2
0
std::vector<std::string> SuperUser::GetUserInfo(const char* bzID )
{
    std::vector<std::string> perms;

    std::string info = Users.item("Users",bzID);

    if (info.size() > 0)
        perms = tokenize(info,std::string(","),0,true);

    return perms;
}
Пример #3
0
int ServerControl::loadConfig(const char *cmdLine)
{
  PluginConfig config = PluginConfig(cmdLine);
  string section = "ServerControl";

  if (config.errors) return -1;

  serverActive = false;
  countPlayers( join , NULL );

  lastTime = 0.0f;

  /*
   * Set up options from the configuration file
   */
  banFilename = config.item(section, "BanFile");
  masterBanFilename = config.item(section, "MasterBanFile");
  resetServerOnceFilename = config.item(section, "ResetServerOnceFile");
  resetServerAlwaysFilename = config.item(section, "ResetServerAlwaysFile");
  banReloadMessage = config.item(section, "BanReloadMessage");
  masterBanReloadMessage = config.item(section, "MasterBanReloadMessage");
  ignoreObservers = (config.item(section, "IgnoreObservers") != "");

  /*
   * Report settings
   */
  // Ban file
  if (banFilename == "")
    bz_debugMessagef(1, "ServerControl - No banfile checks - no BanFile specified");
  else
    bz_debugMessagef(1, "ServerControl - Monitoring ban file: %s", banFilename.c_str());
  // Ban reload message
  if (banReloadMessage == "")
    bz_debugMessagef(1, "ServerControl - No BanReloadMessage notification");
  else
    bz_debugMessagef(1, "ServerControl - BanReloadMessage: %s", banReloadMessage.c_str());
  // Masterban file
  if (masterBanFilename == "")
    bz_debugMessagef(1, "ServerControl - No masterban file checks - no MasterbanFile specified");
  else
    bz_debugMessagef(1, "ServerControl - Monitoring master ban file: %s", masterBanFilename.c_str());
  // Master Ban reload message
  if (masterBanReloadMessage == "")
    bz_debugMessagef(1, "ServerControl - No MasterBanReloadMessage notification");
  else
    bz_debugMessagef(1, "ServerControl - MasterBanReloadMessage: %s", masterBanReloadMessage.c_str());
  // Reset Server Once file
  if (resetServerOnceFilename == "")
    bz_debugMessagef(1, "ServerControl - No ResetServerOnceFile specified");
  else
    bz_debugMessagef(1, "ServerControl - Using ResetServerOnceFile: %s", resetServerOnceFilename.c_str());
  // Reset Server Always file
  if (resetServerAlwaysFilename == "")
    bz_debugMessagef(1, "ServerControl - No ResetServerAlwaysFile specified");
  else
    bz_debugMessagef(1, "ServerControl - Using ResetServerAlwaysFile: %s", resetServerAlwaysFilename.c_str());

  // Ignore Observers
  if (ignoreObservers)
    bz_debugMessage(1, "ServerControl - Ignoring Observers for server restarts");
  else
    bz_debugMessage(1, "ServerControl - Server must be empty for server restarts");

  /* Set the initial ban file access times */
  masterBanErrorLogged = false;
  banFileErrorLogged = false;
  if (masterBanFilename != "")
    fileAccessTime(masterBanFilename, &masterBanFileAccessTime, &masterBanErrorLogged);
  if (banFilename != "")
    fileAccessTime(banFilename, &banFileAccessTime, &banFileErrorLogged);

  return 0;
}