From b15cffc167391fc8af6cab52061d4b591ec5bbf8 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 7 Mar 2014 18:09:21 +0100 Subject: Move admin settings into core_info --- include/configreader.h | 15 --------------- src/configreader.cpp | 3 --- src/coremods/core_info/cmd_admin.cpp | 8 ++++---- src/coremods/core_info/core_info.cpp | 8 ++++++++ src/coremods/core_info/core_info.h | 15 +++++++++++++++ 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/include/configreader.h b/include/configreader.h index fd6452b31..3cb75ad37 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -297,21 +297,6 @@ class CoreExport ServerConfig */ std::string ServerDesc; - /** Holds the admin's name, for output in - * the /ADMIN command. - */ - std::string AdminName; - - /** Holds the email address of the admin, - * for output in the /ADMIN command. - */ - std::string AdminEmail; - - /** Holds the admin's nickname, for output - * in the /ADMIN command - */ - std::string AdminNick; - /** Pretend disabled commands don't exist. */ bool DisabledDontExist; diff --git a/src/configreader.cpp b/src/configreader.cpp index 6d5fc9a87..b9417bf3c 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -372,9 +372,6 @@ void ServerConfig::Fill() XLineMessage = options->getString("xlinemessage", options->getString("moronbanner", "You're banned!")); ServerDesc = ConfValue("server")->getString("description", "Configure Me"); Network = ConfValue("server")->getString("network", "Network"); - AdminName = ConfValue("admin")->getString("name", ""); - AdminEmail = ConfValue("admin")->getString("email", "null@example.com"); - AdminNick = ConfValue("admin")->getString("nick", "admin"); NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240, 1024, 65534); dns_timeout = ConfValue("dns")->getInt("timeout", 5); DisabledCommands = ConfValue("disabled")->getString("commands", ""); diff --git a/src/coremods/core_info/cmd_admin.cpp b/src/coremods/core_info/cmd_admin.cpp index 4832f22b6..722ef8668 100644 --- a/src/coremods/core_info/cmd_admin.cpp +++ b/src/coremods/core_info/cmd_admin.cpp @@ -36,13 +36,13 @@ CmdResult CommandAdmin::Handle (const std::vector& parameters, User return CMD_SUCCESS; user->SendText(":%s %03d %s :Administrative info for %s", ServerInstance->Config->ServerName.c_str(), RPL_ADMINME, user->nick.c_str(),ServerInstance->Config->ServerName.c_str()); - if (!ServerInstance->Config->AdminName.empty()) + if (!AdminName.empty()) user->SendText(":%s %03d %s :Name - %s", ServerInstance->Config->ServerName.c_str(), - RPL_ADMINLOC1, user->nick.c_str(), ServerInstance->Config->AdminName.c_str()); + RPL_ADMINLOC1, user->nick.c_str(), AdminName.c_str()); user->SendText(":%s %03d %s :Nickname - %s", ServerInstance->Config->ServerName.c_str(), - RPL_ADMINLOC2, user->nick.c_str(), ServerInstance->Config->AdminNick.c_str()); + RPL_ADMINLOC2, user->nick.c_str(), AdminNick.c_str()); user->SendText(":%s %03d %s :E-Mail - %s", ServerInstance->Config->ServerName.c_str(), - RPL_ADMINEMAIL, user->nick.c_str(), ServerInstance->Config->AdminEmail.c_str()); + RPL_ADMINEMAIL, user->nick.c_str(), AdminEmail.c_str()); return CMD_SUCCESS; } diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp index 09f8ad18d..56c3c956d 100644 --- a/src/coremods/core_info/core_info.cpp +++ b/src/coremods/core_info/core_info.cpp @@ -36,6 +36,14 @@ class CoreModInfo : public Module { } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ConfigTag* tag = ServerInstance->Config->ConfValue("admin"); + cmdadmin.AdminName = tag->getString("name"); + cmdadmin.AdminEmail = tag->getString("email", "null@example.com"); + cmdadmin.AdminNick = tag->getString("nick", "admin"); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Provides the ADMIN, COMMANDS, INFO, MODULES, MOTD, TIME and VERSION commands", VF_VENDOR|VF_CORE); diff --git a/src/coremods/core_info/core_info.h b/src/coremods/core_info/core_info.h index 894616cf7..f5dd9e648 100644 --- a/src/coremods/core_info/core_info.h +++ b/src/coremods/core_info/core_info.h @@ -26,6 +26,21 @@ class CommandAdmin : public Command { public: + /** Holds the admin's name, for output in + * the /ADMIN command. + */ + std::string AdminName; + + /** Holds the email address of the admin, + * for output in the /ADMIN command. + */ + std::string AdminEmail; + + /** Holds the admin's nickname, for output + * in the /ADMIN command + */ + std::string AdminNick; + /** Constructor for admin. */ CommandAdmin(Module* parent); -- cgit v1.2.3