From: Peter Powell Date: Mon, 1 Oct 2018 15:53:27 +0000 (+0100) Subject: Move into core_stats. X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=08177bccc25500994d96dfa8679cd7da30cdb800;p=user%2Fhenk%2Fcode%2Finspircd.git Move into core_stats. --- diff --git a/include/configreader.h b/include/configreader.h index 2a1f07283..c63ea717a 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -396,11 +396,6 @@ class CoreExport ServerConfig */ ClassVector Classes; - /** STATS characters in this list are available - * only to operators. - */ - std::string UserStats; - /** Default channel modes */ std::string DefaultModes; diff --git a/src/configreader.cpp b/src/configreader.cpp index 661e81a6a..f9eebe672 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -407,7 +407,6 @@ void ServerConfig::Fill() Network = server->getString("network", "Network"); NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240, 1024, 65534); DisabledDontExist = ConfValue("disabled")->getBool("fakenonexistant"); - UserStats = security->getString("userstats"); CustomVersion = security->getString("customversion"); HideBans = security->getBool("hidebans"); HideServer = security->getString("hideserver", security->getString("hidewhois")); diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index 06602b288..6a4427aef 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -36,8 +36,9 @@ class CommandStats : public Command void DoStats(Stats::Context& stats); public: - /** Constructor for stats. - */ + /** STATS characters which non-opers can request. */ + std::string userstats; + CommandStats(Module* Creator) : Command(Creator, "STATS", 1, 2) , statsevprov(Creator, "event/stats") @@ -77,7 +78,7 @@ void CommandStats::DoStats(Stats::Context& stats) User* const user = stats.GetSource(); const char statschar = stats.GetSymbol(); - bool isPublic = ServerInstance->Config->UserStats.find(statschar) != std::string::npos; + bool isPublic = userstats.find(statschar) != std::string::npos; bool isRemoteOper = IS_REMOTE(user) && (user->IsOper()); bool isLocalOperWithPrivs = IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"); @@ -408,6 +409,12 @@ class CoreModStats : public Module { } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ConfigTag* security = ServerInstance->Config->ConfValue("security"); + cmd.userstats = security->getString("userstats"); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Provides the STATS command", VF_CORE | VF_VENDOR);