]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Provide a facility for modules to flag a config file completed
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 11 Nov 2007 19:34:06 +0000 (19:34 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 11 Nov 2007 19:34:06 +0000 (19:34 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8576 e03df62e-2008-0410-955e-edbf42e46eb7

include/configreader.h
src/configreader.cpp

index eed74f10a9b964eb79aa6cd645277019fc266b79..ac9d0273a905601c9dcac1aa03396ba59cfa9b94 100644 (file)
@@ -260,6 +260,8 @@ class CoreExport ServerConfig : public Extensible
        bool Downloading();
 
        void StartDownloads();
+
+       void Complete(const std::string &filename, bool error);
          
        /** This holds all the information in the config file,
         * it's indexed by tag name to a vector of key/values.
index 7b033a64bbfd8e4215dacdc5d7a41156c800043e..ca8be9fefebdc29d54a4e9881024b04eb38c10c7 100644 (file)
@@ -1208,6 +1208,10 @@ void ServerConfig::Read(bool bail, User* user, int pass)
        {
                for (std::vector<std::string>::iterator adding = added_modules.begin(); adding != added_modules.end(); adding++)
                {
+                       /* Skip over modules that are aleready loaded for some reason */
+                       if (ServerInstance->Modules->Find(*adding))
+                               continue;
+
                        if (bail)
                                printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n", adding->c_str());
 
@@ -1253,6 +1257,24 @@ bool ServerConfig::Downloading()
        return (TotalDownloaded < IncludedFiles.size());
 }
 
+void ServerConfig::Complete(const std::string &filename, bool error)
+{
+       std::map<std::string, std::istream*>::iterator x = IncludedFiles.find(filename);
+
+       if (x != IncludedFiles.end())
+       {
+               TotalDownloaded++;
+               if (error)
+               {
+                       delete x->second;
+                       x->second = NULL;
+                       FileErrors++;
+               }
+       }
+
+       return;
+}
+
 void ServerConfig::StartDownloads()
 {
        if (isatty(0) && isatty(1) && isatty(2))