diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-14 14:26:38 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-14 14:26:38 +0000 |
commit | 70141d07c0e815b2c3794917738b3b740ccd42ea (patch) | |
tree | 9f2d8e0b1073f277902f62150ec47a97b5585187 | |
parent | b1a61e6eb309f323fa75c6c8cfe431aa5c931020 (diff) |
Moved a ton of *Conf functions into the ServerConfig class
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2412 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/inspircd_io.h | 12 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 16 |
2 files changed, 18 insertions, 10 deletions
diff --git a/include/inspircd_io.h b/include/inspircd_io.h index e4f2c6de9..eea14d6c0 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -35,6 +35,7 @@ class ServerConfig { private: std::vector<std::string> include_stack; + fgets_safe(char* buffer, size_t maxsize, FILE* &file); public: char ServerName[MAXBUF]; @@ -76,6 +77,12 @@ class ServerConfig ServerConfig(); void ClearStack(); void Read(bool bail, userrec* user); + bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream); + int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config); + int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result); + int ConfValueEnum(char* tag,std::stringstream *config); + int EnumConf(std::stringstream *config_f,const char* tag); + int EnumValues(std::stringstream *config, const char* tag, int index); }; @@ -86,12 +93,13 @@ bool FileExists (const char* file); int OpenTCPSocket (void); int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr); -bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream); +/*bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream); int ConfValue(char* tag, char* var, int index, char *result, std::stringstream *config); int ReadConf(std::stringstream *config_f,const char* tag, const char* var, int index, char *result); int ConfValueEnum(char* tag,std::stringstream *config); int EnumConf(std::stringstream *config_f,const char* tag); -int EnumValues(std::stringstream *config, const char* tag, int index); +int EnumValues(std::stringstream *config, const char* tag, int index);*/ + void WritePID(std::string filename); #endif diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 6ad775dbb..8b4697b1f 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -455,7 +455,7 @@ bool FileExists (const char* file) * Turns multiple spaces that are outside of quotes into single spaces */ -std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errorstream, bool &error, std::string filename) +std::string ServerConfig::ConfProcess(char* buffer, long linenumber, std::stringstream* errorstream, bool &error, std::string filename) { long number_of_quotes = 0; long number_of_equals = 0; @@ -574,7 +574,7 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors return parsedata; } -int fgets_safe(char* buffer, size_t maxsize, FILE* &file) +int ServerConfig::fgets_safe(char* buffer, size_t maxsize, FILE* &file) { char c_read = '\0'; unsigned int bufptr = 0; @@ -588,7 +588,7 @@ int fgets_safe(char* buffer, size_t maxsize, FILE* &file) return bufptr; } -bool LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream) +bool ServerConfig::LoadConf(const char* filename, std::stringstream *target, std::stringstream* errorstream) { target->str(""); errorstream->str(""); @@ -690,7 +690,7 @@ bool LoadConf(const char* filename, std::stringstream *target, std::stringstream /* Counts the number of tags of a certain type within the config file, e.g. to enumerate opers */ -int EnumConf(std::stringstream *config, const char* tag) +int ServerConfig::EnumConf(std::stringstream *config, const char* tag) { int ptr = 0; char buffer[MAXBUF], c_tag[MAXBUF], c, lastc; @@ -760,7 +760,7 @@ int EnumConf(std::stringstream *config, const char* tag) /* Counts the number of values within a certain tag */ -int EnumValues(std::stringstream *config, const char* tag, int index) +int ServerConfig::EnumValues(std::stringstream *config, const char* tag, int index) { int ptr = 0; char buffer[MAXBUF], c_tag[MAXBUF], c, lastc; @@ -845,7 +845,7 @@ int EnumValues(std::stringstream *config, const char* tag, int index) -int ConfValueEnum(char* tag, std::stringstream* config) +int ServerConfig::ConfValueEnum(char* tag, std::stringstream* config) { return EnumConf(config,tag); } @@ -858,7 +858,7 @@ int ConfValueEnum(char* tag, std::stringstream* config) * ConfValue("oper","name",2,result); */ -int ReadConf(std::stringstream *config, const char* tag, const char* var, int index, char *result) +int ServerConfig::ReadConf(std::stringstream *config, const char* tag, const char* var, int index, char *result) { int ptr = 0; char buffer[65535], c_tag[MAXBUF], c, lastc; @@ -968,7 +968,7 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in -int ConfValue(char* tag, char* var, int index, char *result,std::stringstream *config) +int ServerConfig::ConfValue(char* tag, char* var, int index, char *result,std::stringstream *config) { ReadConf(config, tag, var, index, result); return 0; |