]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
Add DYING link state, push error messages on link, and only limit recvq on unauthenti...
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index eced0c56a10b942f87d048335897e0f2c1fffde5..bba8dc8dca480f220d4b3a48f666ce2d360c0f24 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -276,36 +276,19 @@ bool IsSIDHandler::Call(const std::string &str)
 /* open the proper logfile */
 bool InspIRCd::OpenLog(char**, int)
 {
-       /* This function only happens at startup now */
-       if (Config->nofork)
-       {
-               this->Logs->SetupNoFork();
-       }
+       if (!Config->cmdline.writelog) return true; // Skip opening default log if -nolog
 
-       if (!Config->writelog) return true; // Skip opening default log if -nolog
+       if (Config->cmdline.startup_log.empty())
+               Config->cmdline.startup_log = "logs/startup.log";
+       FILE* startup = fopen(Config->cmdline.startup_log.c_str(), "a+");
 
-       if (!*this->LogFileName)
-       {
-               if (Config->logpath.empty())
-               {
-                       Config->logpath = "logs/startup.log";
-               }
-
-               if (!Config->log_file)
-                       Config->log_file = fopen(Config->logpath.c_str(),"a+");
-       }
-       else
-       {
-               Config->log_file = fopen(this->LogFileName,"a+");
-       }
-
-       if (!Config->log_file)
+       if (!startup)
        {
                return false;
        }
 
-       FileWriter* fw = new FileWriter(Config->log_file);
-       FileLogStream *f = new FileLogStream((Config->forcedebug ? DEBUG : DEFAULT), fw);
+       FileWriter* fw = new FileWriter(startup);
+       FileLogStream *f = new FileLogStream((Config->cmdline.forcedebug ? DEBUG : DEFAULT), fw);
 
        this->Logs->AddLogType("*", f, true);
 
@@ -413,13 +396,18 @@ std::string InspIRCd::TimeString(time_t curtime)
 void InspIRCd::AddExtBanChar(char c)
 {
        std::string &tok = Config->data005;
-       std::string::size_type ebpos;
+       std::string::size_type ebpos = tok.find(" EXTBAN=,");
 
-       if ((ebpos = tok.find(" EXTBAN=,")) == std::string::npos)
+       if (ebpos == std::string::npos)
        {
                tok.append(" EXTBAN=,");
                tok.push_back(c);
        }
        else
-               tok.insert(ebpos + 9, 1, c);
+       {
+               ebpos += 9;
+               while (isalpha(tok[ebpos]) && tok[ebpos] < c)
+                       ebpos++;
+               tok.insert(ebpos, 1, c);
+       }
 }