diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.layout | 56 | ||||
-rw-r--r-- | src/modules.cpp | 70 |
2 files changed, 94 insertions, 32 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 97a83473e..2588ce0bc 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=-1 +Focused=4 Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0,49 [Editor_0] @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=0 -CursorCol=40 -CursorRow=2952 -TopLine=2928 +CursorCol=1 +CursorRow=1 +TopLine=1 LeftChar=1 [Editor_2] @@ -23,7 +23,7 @@ Open=1 Top=0 CursorCol=18 CursorRow=354 -TopLine=327 +TopLine=110 LeftChar=1 [Editor_3] @@ -36,10 +36,10 @@ LeftChar=1 [Editor_4] Open=1 -Top=0 -CursorCol=48 -CursorRow=160 -TopLine=132 +Top=1 +CursorCol=7 +CursorRow=557 +TopLine=545 LeftChar=1 [Editor_5] @@ -101,9 +101,9 @@ LeftChar=1 [Editor_12] Open=1 Top=0 -CursorCol=1 -CursorRow=16 -TopLine=1 +CursorCol=9 +CursorRow=193 +TopLine=45 LeftChar=1 [Editor_13] @@ -165,9 +165,9 @@ LeftChar=1 [Editor_20] Open=1 Top=0 -CursorCol=71 -CursorRow=279 -TopLine=259 +CursorCol=13 +CursorRow=629 +TopLine=592 LeftChar=1 [Editor_21] @@ -180,10 +180,10 @@ LeftChar=1 [Editor_22] Open=1 -Top=1 +Top=0 CursorCol=1 -CursorRow=190 -TopLine=135 +CursorRow=22 +TopLine=3 LeftChar=1 [Editor_23] @@ -205,8 +205,8 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=1 -TopLine=1 +CursorRow=134 +TopLine=116 LeftChar=1 [Editor_26] Open=1 @@ -330,16 +330,16 @@ LeftChar=1 [Editor_43] Open=1 Top=0 -CursorCol=1 -CursorRow=90 -TopLine=52 +CursorCol=4 +CursorRow=688 +TopLine=661 LeftChar=1 [Editor_44] Open=1 Top=0 -CursorCol=63 -CursorRow=63 -TopLine=16 +CursorCol=6 +CursorRow=98 +TopLine=44 LeftChar=1 [Editor_45] Open=1 @@ -380,6 +380,6 @@ LeftChar=1 Open=1 Top=0 CursorCol=2 -CursorRow=250 -TopLine=196 +CursorRow=301 +TopLine=248 LeftChar=1 diff --git a/src/modules.cpp b/src/modules.cpp index e05ab4566..23b45e8aa 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -553,7 +553,9 @@ int Server::CountUsers(chanrec* c) ConfigReader::ConfigReader() { this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); - this->error = LoadConf(CONFIG_FILE,this->cache); + this->readerror = LoadConf(CONFIG_FILE,this->cache); + if (!this->readerror) + this->error = CONF_FILE_NOT_FOUND; } @@ -567,7 +569,9 @@ ConfigReader::~ConfigReader() ConfigReader::ConfigReader(std::string filename) { this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out); - this->error = LoadConf(filename.c_str(),this->cache); + this->readerror = LoadConf(filename.c_str(),this->cache); + if (!this->readerror) + this->error = CONF_FILE_NOT_FOUND; }; std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) @@ -577,10 +581,68 @@ std::string ConfigReader::ReadValue(std::string tag, std::string name, int index char n[MAXBUF]; strncpy(t,tag.c_str(),MAXBUF); strncpy(n,name.c_str(),MAXBUF); - ReadConf(cache,t,n,index,val); + int res = ReadConf(cache,t,n,index,val); + if (!res) + { + this->error = CONF_VALUE_NOT_FOUND; + return ""; + } return std::string(val); } +bool ConfigReader::ReadFlag(std::string tag, std::string name, int index) +{ + char val[MAXBUF]; + char t[MAXBUF]; + char n[MAXBUF]; + strncpy(t,tag.c_str(),MAXBUF); + strncpy(n,name.c_str(),MAXBUF); + int res = ReadConf(cache,t,n,index,val); + if (!res) + { + this->error = CONF_VALUE_NOT_FOUND; + return false; + } + std::string s = val; + return ((s == "yes") || (s == "YES") || (s == "true") || (s == "TRUE") || (s == "1")); +} + +long ConfigReader::ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned) +{ + char val[MAXBUF]; + char t[MAXBUF]; + char n[MAXBUF]; + strncpy(t,tag.c_str(),MAXBUF); + strncpy(n,name.c_str(),MAXBUF); + int res = ReadConf(cache,t,n,index,val); + if (!res) + { + this->error = CONF_VALUE_NOT_FOUND; + return 0; + } + for (int i = 0; i < strlen(val); i++) + { + if (!isdigit(val[i])) + { + this->error = CONF_NOT_A_NUMBER; + return 0; + } + } + if ((needs_unsigned) && (atoi(val)<0)) + { + this->error = CONF_NOT_UNSIGNED; + return 0; + } + return atoi(val); +} + +long ConfigReader::GetError() +{ + long olderr = this->error; + this->error = 0; + return olderr; +} + int ConfigReader::Enumerate(std::string tag) { @@ -594,7 +656,7 @@ int ConfigReader::EnumerateValues(std::string tag, int index) bool ConfigReader::Verify() { - return this->error; + return this->readerror; } |