aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorGravatar brain2005-03-25 02:52:43 +0000
committerGravatar brain2005-03-25 02:52:43 +0000
commit0340f1a432d684347d8dbc3aa85c8436c56d4039 (patch)
tree0da4a282f28b42d5447ff2ee6f645c7936cf4383 /src/modules.cpp
parentFinally fixed a load of umode change stuff! (diff)
downloadinspircd++-0340f1a432d684347d8dbc3aa85c8436c56d4039.tar.gz
inspircd++-0340f1a432d684347d8dbc3aa85c8436c56d4039.tar.bz2
inspircd++-0340f1a432d684347d8dbc3aa85c8436c56d4039.zip
Added a lot of config error checking
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@898 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index aae7a53e2..15508ae19 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -566,7 +566,8 @@ int Server::CountUsers(chanrec* c)
ConfigReader::ConfigReader()
{
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
- this->readerror = LoadConf(CONFIG_FILE,this->cache);
+ this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
+ this->readerror = LoadConf(CONFIG_FILE,this->cache,this->errorlog);
if (!this->readerror)
this->error = CONF_FILE_NOT_FOUND;
}
@@ -576,13 +577,16 @@ ConfigReader::~ConfigReader()
{
if (this->cache)
delete this->cache;
+ if (this->errorlog)
+ delete this->errorlog;
}
ConfigReader::ConfigReader(std::string filename)
{
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
- this->readerror = LoadConf(filename.c_str(),this->cache);
+ this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
+ this->readerror = LoadConf(filename.c_str(),this->cache,this->errorlog);
if (!this->readerror)
this->error = CONF_FILE_NOT_FOUND;
};
@@ -656,6 +660,38 @@ long ConfigReader::GetError()
return olderr;
}
+void ConfigReader::DumpErrors(bool bail, userrec* user)
+{
+ if (bail)
+ {
+ printf("There were errors in your configuration:\n%s",errorlog->str().c_str());
+ exit(0);
+ }
+ else
+ {
+ char dataline[1024];
+ if (user)
+ {
+ WriteServ(user->fd,"NOTICE %s :There were errors in the configuration file:",user->nick);
+ while (!errorlog->eof())
+ {
+ errorlog->getline(dataline,1024);
+ WriteServ(user->fd,"NOTICE %s :%s",user->nick,dataline);
+ }
+ }
+ else
+ {
+ WriteOpers("There were errors in the configuration file:",user->nick);
+ while (!errorlog->eof())
+ {
+ errorlog->getline(dataline,1024);
+ WriteOpers(dataline);
+ }
+ }
+ return;
+ }
+}
+
int ConfigReader::Enumerate(std::string tag)
{