diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/configparser.h | 4 | ||||
-rw-r--r-- | include/configreader.h | 17 | ||||
-rw-r--r-- | include/typedefs.h | 4 |
3 files changed, 12 insertions, 13 deletions
diff --git a/include/configparser.h b/include/configparser.h index 3240ff5f9..1054b1f7f 100644 --- a/include/configparser.h +++ b/include/configparser.h @@ -22,10 +22,11 @@ struct ParseStack std::vector<std::string> reading; std::map<std::string, std::string> vars; ConfigDataHash& output; + ConfigFileCache& FilesOutput; std::stringstream& errstr; ParseStack(ServerConfig* conf) - : output(conf->config_data), errstr(conf->errstr) + : output(conf->config_data), FilesOutput(conf->Files), errstr(conf->errstr) { vars["amp"] = "&"; vars["quot"] = "\""; @@ -34,6 +35,7 @@ struct ParseStack bool ParseFile(const std::string& name, int flags); bool ParseExec(const std::string& name, int flags); void DoInclude(ConfigTag* includeTag, int flags); + void DoReadFile(const std::string& key, const std::string& file, int flags, bool exec); }; /** RAII wrapper on FILE* to close files on exceptions */ diff --git a/include/configreader.h b/include/configreader.h index 3d01d7e91..112736439 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -219,6 +219,11 @@ class CoreExport ServerConfig */ ConfigDataHash config_data; + /** This holds all extra files that have been read in the configuration + * (for example, MOTD and RULES files are stored here) + */ + ConfigFileCache Files; + /** Length limits, see definition of ServerLimits class */ ServerLimits Limits; @@ -435,14 +440,6 @@ class CoreExport ServerConfig */ std::string HideKillsServer; - /** The MOTD file, cached in a file_cache type. - */ - file_cache MOTD; - - /** The RULES file, cached in a file_cache type. - */ - file_cache RULES; - /** The full pathname and filename of the PID * file as defined in the configuration. */ @@ -555,10 +552,6 @@ class CoreExport ServerConfig void Fill(); - /** Read a file into a file_cache object - */ - bool ReadFile(file_cache &F, const std::string& fname); - /* Returns true if the given string starts with a windows drive letter */ bool StartsWithWindowsDriveLetter(const std::string &path); diff --git a/include/typedefs.h b/include/typedefs.h index bea8e33ef..5ca49493b 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -97,6 +97,7 @@ typedef std::pair<std::string, std::string> KeyVal; /** The entire configuration */ typedef std::multimap<std::string, reference<ConfigTag> > ConfigDataHash; + /** Iterator of ConfigDataHash */ typedef ConfigDataHash::const_iterator ConfigIter; /** Iterator pair, used for tag-name ranges */ @@ -105,6 +106,9 @@ typedef std::pair<ConfigIter,ConfigIter> ConfigTagList; /** Index of valid oper blocks and types */ typedef std::map<std::string, reference<OperInfo> > OperIndex; +/** Files read by the configuration */ +typedef std::map<std::string, file_cache> ConfigFileCache; + /** A hash of commands used by the core */ typedef nspace::hash_map<std::string,Command*> Commandtable; |