]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_info/core_info.cpp
Update the module descriptions.
[user/henk/code/inspircd.git] / src / coremods / core_info / core_info.cpp
index 2d7a89475e6976a6e0763b686d9586623fba1272..f138494c89564bfa433eda34c5ac2d500375eeb0 100644 (file)
@@ -1,7 +1,9 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2018, 2020 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
+ *   Copyright (C) 2014, 2016, 2018 Attila Molnar <attilamolnar@hush.com>
  *
  * 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,6 +103,28 @@ class CoreModInfo : public Module
 
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
+               // Process the escape codes in the MOTDs.
+               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 = tag->getString("motd", "motd");
+                       if (newmotds.find(motd) != newmotds.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.
+                       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");
@@ -130,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);
                }
        }
@@ -152,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);
        }
 };