]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
Add fine-grained command flood controls
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index cd173b55ffb1148fe22ab32013a957552815ab09..94ba6a03728e42d989f313b33abf49d8d141bd12 100644 (file)
@@ -123,7 +123,7 @@ Channel* InspIRCd::FindChan(const std::string &chan)
 /* Send an error notice to all users, registered or not */
 void InspIRCd::SendError(const std::string &s)
 {
-       for (std::vector<User*>::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); i++)
+       for (std::vector<LocalUser*>::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); i++)
        {
                User* u = *i;
                if (u->registered == REG_ALL)
@@ -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->writelog) return true; // Skip opening default log if -nolog
+       if (!Config->cmdline.writelog) return true; // Skip opening default log if -nolog
 
-       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->cmdline.startup_log.empty())
+               Config->cmdline.startup_log = "logs/startup.log";
+       FILE* startup = fopen(Config->cmdline.startup_log.c_str(), "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);