summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp10
-rw-r--r--src/coremods/core_info/cmd_motd.cpp4
-rw-r--r--src/coremods/core_info/core_info.cpp20
-rw-r--r--src/coremods/core_info/core_info.h2
4 files changed, 24 insertions, 12 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index f5a8abb00..ce03f1d9e 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -566,16 +566,6 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
errstr.clear();
errstr.str(std::string());
- // Re-parse our MOTD and RULES files for colors -- Justasic
- for (ClassVector::const_iterator it = this->Classes.begin(), it_end = this->Classes.end(); it != it_end; ++it)
- {
- ConfigTag *tag = (*it)->config;
-
- ConfigFileCache::iterator file = this->Files.find(tag->getString("motd", "motd"));
- if (file != this->Files.end())
- InspIRCd::ProcessColors(file->second);
- }
-
/* No old configuration -> initial boot, nothing more to do here */
if (!old)
{
diff --git a/src/coremods/core_info/cmd_motd.cpp b/src/coremods/core_info/cmd_motd.cpp
index cc770b157..e4c575539 100644
--- a/src/coremods/core_info/cmd_motd.cpp
+++ b/src/coremods/core_info/cmd_motd.cpp
@@ -45,8 +45,8 @@ CmdResult CommandMotd::Handle(User* user, const Params& parameters)
if (localuser)
tag = localuser->GetClass()->config;
std::string motd_name = tag->getString("motd", "motd");
- ConfigFileCache::iterator motd = ServerInstance->Config->Files.find(motd_name);
- if (motd == ServerInstance->Config->Files.end())
+ ConfigFileCache::iterator motd = motds.find(motd_name);
+ if (motd == motds.end())
{
user->WriteRemoteNumeric(ERR_NOMOTD, "Message of the day file is missing.");
return CMD_SUCCESS;
diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp
index 2d7a89475..2d6f0d249 100644
--- a/src/coremods/core_info/core_info.cpp
+++ b/src/coremods/core_info/core_info.cpp
@@ -103,6 +103,26 @@ class CoreModInfo : public Module
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();
+ for (ServerConfig::ClassVector::const_iterator iter = ServerInstance->Config->Classes.begin(); iter != ServerInstance->Config->Classes.end(); ++iter)
+ {
+ // 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())
+ continue;
+
+ // We can't process the file if it doesn't exist.
+ ConfigFileCache::iterator file = ServerInstance->Config->Files.find(motd);
+ if (file == ServerInstance->Config->Files.end())
+ continue;
+
+ // Process escape codes.
+ cmdmotd.motds[file->first] = file->second;
+ InspIRCd::ProcessColors(cmdmotd.motds[file->first]);
+ }
+
}
void OnUserConnect(LocalUser* user) CXX11_OVERRIDE
diff --git a/src/coremods/core_info/core_info.h b/src/coremods/core_info/core_info.h
index 127041b46..5cc619a4a 100644
--- a/src/coremods/core_info/core_info.h
+++ b/src/coremods/core_info/core_info.h
@@ -122,6 +122,8 @@ class CommandModules : public ServerTargetCommand
class CommandMotd : public ServerTargetCommand
{
public:
+ ConfigFileCache motds;
+
/** Constructor for motd.
*/
CommandMotd(Module* parent);