X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcoremods%2Fcore_info%2Fcore_info.cpp;h=24eaaae03a717899109f5dd92f4c6cc266ef6d25;hb=ee23dd450ed713d907d0ecdeec356971439d4356;hp=2d6f0d2493d41c2694cc75be7c9e0dbfdb3c2400;hpb=372c5c94964263ba6c1f2f44079aac3aff448225;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp index 2d6f0d249..24eaaae03 100644 --- a/src/coremods/core_info/core_info.cpp +++ b/src/coremods/core_info/core_info.cpp @@ -1,7 +1,9 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2014 Attila Molnar + * Copyright (C) 2018, 2020 Sadie Powell + * Copyright (C) 2018 linuxdaemon + * Copyright (C) 2014, 2016, 2018 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -44,6 +46,7 @@ class CoreModInfo : public Module CommandInfo cmdinfo; CommandModules cmdmodules; CommandMotd cmdmotd; + CommandServList cmdservlist; CommandTime cmdtime; CommandVersion cmdversion; Numeric::Numeric numeric004; @@ -89,6 +92,7 @@ class CoreModInfo : public Module , cmdinfo(this) , cmdmodules(this) , cmdmotd(this) + , cmdservlist(this) , cmdtime(this) , cmdversion(this) , numeric004(RPL_MYINFO) @@ -99,18 +103,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"); - // Process the escape codes in the MOTDs. - cmdmotd.motds.clear(); + ConfigFileCache newmotds; for (ServerConfig::ClassVector::const_iterator iter = ServerInstance->Config->Classes.begin(); iter != ServerInstance->Config->Classes.end(); ++iter) { + ConfigTag* tag = (*iter)->config; // Don't process the file if it has already been processed. - const std::string motd = (*iter)->config->getString("motd", "motd"); - if (cmdmotd.motds.find(motd) != cmdmotd.motds.end()) + const std::string motd = tag->getString("motd", "motd"); + if (newmotds.find(motd) != newmotds.end()) continue; // We can't process the file if it doesn't exist. @@ -119,16 +119,22 @@ class CoreModInfo : public Module continue; // Process escape codes. - cmdmotd.motds[file->first] = file->second; - InspIRCd::ProcessColors(cmdmotd.motds[file->first]); + newmotds[file->first] = file->second; + InspIRCd::ProcessColors(newmotds[file->first]); } + cmdmotd.motds.swap(newmotds); + + 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"); } void OnUserConnect(LocalUser* user) CXX11_OVERRIDE { user->WriteNumeric(RPL_WELCOME, InspIRCd::Format("Welcome to the %s IRC Network %s", ServerInstance->Config->Network.c_str(), user->GetFullRealHost().c_str())); - user->WriteNumeric(RPL_YOURHOST, InspIRCd::Format("Your host is %s, running version %s", ServerInstance->Config->ServerName.c_str(), INSPIRCD_BRANCH)); + user->WriteNumeric(RPL_YOURHOST, InspIRCd::Format("Your host is %s, running version %s", ServerInstance->Config->GetServerName().c_str(), INSPIRCD_BRANCH)); user->WriteNumeric(RPL_CREATED, InspIRCd::TimeString(ServerInstance->startup_time, "This server was created %H:%M:%S %b %d %Y")); user->WriteNumeric(numeric004); @@ -150,7 +156,7 @@ class CoreModInfo : public Module if (ServerInstance->Config->RawLog) { - ClientProtocol::Messages::Privmsg rawlogmsg(ServerInstance->FakeClient, user, "*** Raw I/O logging is enabled on user server. All messages, passwords, and commands are being recorded."); + ClientProtocol::Messages::Privmsg rawlogmsg(ServerInstance->FakeClient, user, "*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded."); user->Send(ServerInstance->GetRFCEvents().privmsg, rawlogmsg); } } @@ -172,7 +178,7 @@ class CoreModInfo : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides the ADMIN, COMMANDS, INFO, MODULES, MOTD, TIME and VERSION commands", VF_VENDOR|VF_CORE); + return Version("Provides the ADMIN, COMMANDS, INFO, MODULES, MOTD, TIME, SERVLIST, and VERSION commands", VF_VENDOR|VF_CORE); } };