]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Add extra /map info (connection uptime, and lag time) to /MAP for opers. Adds feature...
[user/henk/code/inspircd.git] / src / configreader.cpp
index 3060b98663404c92128cd853c3a88112daf5db14..26e9634d13c9c9f421c7fe503b1d5e4053dda0be 100644 (file)
@@ -25,9 +25,9 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
 {
        this->ClearStack();
        *ServerName = *Network = *ServerDesc = *AdminName = '\0';
-       *HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = '\0';
+       *HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = *FixedQuit = '\0';
        *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
-       *UserStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
+       *UserStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = *SuffixQuit = '\0';
        WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
        log_file = NULL;
        NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = UndernetMsgPrefix = false;
@@ -39,6 +39,8 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
        MaxConn = SOMAXCONN;
        MaxWhoResults = 100;
        debugging = 0;
+       MaxChans = 20;
+       OperMaxChans = 30;
        LogLevel = DEFAULT;
        maxbans.clear();
 }
@@ -570,6 +572,8 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"power",       "pause",        "",                     new ValueContainerInt  (&this->DieDelay),               DT_INTEGER, NoValidation},
                {"power",       "restartpass",  "",                     new ValueContainerChar (this->restartpass),             DT_CHARPTR, NoValidation},
                {"options",     "prefixquit",   "",                     new ValueContainerChar (this->PrefixQuit),              DT_CHARPTR, NoValidation},
+               {"options",     "suffixquit",   "",                     new ValueContainerChar (this->SuffixQuit),              DT_CHARPTR, NoValidation},
+               {"options",     "fixedquit",    "",                     new ValueContainerChar (this->FixedQuit),               DT_CHARPTR, NoValidation},
                {"options",     "loglevel",     "default",              new ValueContainerChar (debug),                         DT_CHARPTR, ValidateLogLevel},
                {"options",     "netbuffersize","10240",                new ValueContainerInt  (&this->NetBufferSize),          DT_INTEGER, ValidateNetBufferSize},
                {"options",     "maxwho",       "128",                  new ValueContainerInt  (&this->MaxWhoResults),          DT_INTEGER, ValidateMaxWho},
@@ -588,11 +592,15 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"options",     "syntaxhints",  "0",                    new ValueContainerBool (&this->SyntaxHints),            DT_BOOLEAN, NoValidation},
                {"options",     "cyclehosts",   "0",                    new ValueContainerBool (&this->CycleHosts),             DT_BOOLEAN, NoValidation},
                {"options",     "ircumsgprefix","0",                    new ValueContainerBool (&this->UndernetMsgPrefix),      DT_BOOLEAN, NoValidation},
+               {"options",     "announceinvites", "1",                 new ValueContainerBool (&this->AnnounceInvites),        DT_BOOLEAN, NoValidation},
+               {"options",     "hostintopic",  "1",                    new ValueContainerBool (&this->FullHostInTopic),        DT_BOOLEAN, NoValidation},
                {"pid",         "file",         "",                     new ValueContainerChar (this->PID),                     DT_CHARPTR, NoValidation},
                {"whowas",      "groupsize",    "10",                   new ValueContainerInt  (&this->WhoWasGroupSize),        DT_INTEGER, NoValidation},
                {"whowas",      "maxgroups",    "10240",                new ValueContainerInt  (&this->WhoWasMaxGroups),        DT_INTEGER, NoValidation},
                {"whowas",      "maxkeep",      "3600",                 new ValueContainerChar (maxkeep),                       DT_CHARPTR, ValidateWhoWas},
                {"die",         "value",        "",                     new ValueContainerChar (this->DieValue),                DT_CHARPTR, NoValidation},
+               {"channels",    "users",        "20",                   new ValueContainerUInt (&this->MaxChans),               DT_INTEGER, NoValidation},
+               {"channels",    "opers",        "60",                   new ValueContainerUInt (&this->OperMaxChans),           DT_INTEGER, NoValidation},
                {NULL}
        };
 
@@ -674,7 +682,7 @@ void ServerConfig::Read(bool bail, userrec* user)
        /* Make a copy here so if it fails then we can carry on running with an unaffected config */
        ConfigDataHash newconfig;
 
-       if (this->LoadConf(newconfig, CONFIG_FILE, errstr))
+       if (this->LoadConf(newconfig, ServerInstance->ConfigFileName, errstr))
        {
                /* If we succeeded, set the ircd config to the new one */
                this->config_data = newconfig;
@@ -1203,7 +1211,7 @@ bool ServerConfig::DoInclude(ConfigDataHash &target, const std::string &file, st
        std::string newfile;
        std::string::size_type pos;
 
-       confpath = CONFIG_FILE;
+       confpath = ServerInstance->ConfigFileName;
        newfile = file;
 
        for (std::string::iterator c = newfile.begin(); c != newfile.end(); c++)
@@ -1216,7 +1224,7 @@ bool ServerConfig::DoInclude(ConfigDataHash &target, const std::string &file, st
 
        if (file[0] != '/')
        {
-               if((pos = confpath.find("/inspircd.conf")) != std::string::npos)
+               if((pos = confpath.rfind("/")) != std::string::npos)
                {
                        /* Leaves us with just the path */
                        newfile = confpath.substr(0, pos) + std::string("/") + newfile;
@@ -1428,8 +1436,8 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname)
        if (*fname != '/')
        {
                std::string::size_type pos;
-               std::string confpath = CONFIG_FILE;
-               if((pos = confpath.find("/inspircd.conf")) != std::string::npos)
+               std::string confpath = ServerInstance->ConfigFileName;
+               if((pos = confpath.rfind("/")) != std::string::npos)
                {
                        /* Leaves us with just the path */
                        std::string newfile = confpath.substr(0, pos) + std::string("/") + fname;
@@ -1498,12 +1506,12 @@ char* ServerConfig::CleanFilename(char* name)
 
 bool ServerConfig::DirValid(const char* dirandfile)
 {
-       char work[MAXBUF];
-       char buffer[MAXBUF];
-       char otherdir[MAXBUF];
+       char work[1024];
+       char buffer[1024];
+       char otherdir[1024];
        int p;
 
-       strlcpy(work, dirandfile, MAXBUF);
+       strlcpy(work, dirandfile, 1024);
        p = strlen(work);
 
        // we just want the dir
@@ -1519,13 +1527,13 @@ bool ServerConfig::DirValid(const char* dirandfile)
        }
 
        // Get the current working directory
-       if (getcwd(buffer, MAXBUF ) == NULL )
+       if (getcwd(buffer, 1024 ) == NULL )
                return false;
 
        if (chdir(work) == -1)
                return false;
 
-       if (getcwd(otherdir, MAXBUF ) == NULL )
+       if (getcwd(otherdir, 1024 ) == NULL )
                return false;
 
        if (chdir(buffer) == -1)
@@ -1552,12 +1560,12 @@ bool ServerConfig::DirValid(const char* dirandfile)
 
 std::string ServerConfig::GetFullProgDir(char** argv, int argc)
 {
-       char work[MAXBUF];
-       char buffer[MAXBUF];
-       char otherdir[MAXBUF];
+       char work[1024];
+       char buffer[1024];
+       char otherdir[1024];
        int p;
 
-       strlcpy(work,argv[0],MAXBUF);
+       strlcpy(work,argv[0],1024);
        p = strlen(work);
 
        // we just want the dir
@@ -1573,13 +1581,13 @@ std::string ServerConfig::GetFullProgDir(char** argv, int argc)
        }
 
        // Get the current working directory
-       if (getcwd(buffer, MAXBUF) == NULL)
+       if (getcwd(buffer, 1024) == NULL)
                return "";
 
        if (chdir(work) == -1)
                return "";
 
-       if (getcwd(otherdir, MAXBUF) == NULL)
+       if (getcwd(otherdir, 1024) == NULL)
                return "";
 
        if (chdir(buffer) == -1)