]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Make this work on ancient gcc's
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 59eeae98f51de98ace3cb88b6069f0bd171cc80b..93ce426a7e467065bac39cf0e783ccc06d839522 100644 (file)
@@ -30,6 +30,7 @@
 #include <dlfcn.h>
 #include <getopt.h>
 
+
 using irc::sockets::NonBlocking;
 using irc::sockets::Blocking;
 using irc::sockets::insp_ntoa;
@@ -40,8 +41,6 @@ InspIRCd* SI = NULL;
 
 void InspIRCd::AddServerName(const std::string &servername)
 {
-       this->Log(DEBUG,"Adding server name: %s",servername.c_str());
-       
        if(find(servernames.begin(), servernames.end(), servername) == servernames.end())
                servernames.push_back(servername); /* Wasn't already there. */
 }
@@ -80,8 +79,12 @@ void InspIRCd::Cleanup()
        int MyModCount = this->GetModuleCount();
 
        for (unsigned int i = 0; i < stats->BoundPortCount; i++)
+       {
                /* This calls the constructor and closes the listening socket */
                delete Config->openSockfd[i];
+               Config->openSockfd[i] = NULL;
+       }
+       stats->BoundPortCount = 0;
 
        /* We do this more than once, so that any service providers get a
         * chance to be unhooked by the modules using them, but then get
@@ -139,13 +142,22 @@ void InspIRCd::Rehash(int status)
 {
        SI->WriteOpers("Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(CONFIG_FILE));
        SI->CloseLog();
-       SI->OpenLog(this->Config->argv, this->Config->argc);
+       SI->OpenLog(SI->Config->argv, SI->Config->argc);
        SI->RehashUsersAndChans();
        FOREACH_MOD_I(SI, I_OnGarbageCollect, OnGarbageCollect());
        SI->Config->Read(false,NULL);
-       FOREACH_MOD_I(SI,I_OnRehash,OnRehash(""));
+       SI->ResetMaxBans();
+       SI->Res->Rehash();
+       FOREACH_MOD_I(SI,I_OnRehash,OnRehash(NULL,""));
 }
 
+void InspIRCd::ResetMaxBans()
+{
+       for (chan_hash::const_iterator i = chanlist->begin(); i != chanlist->end(); i++)
+               i->second->ResetMaxBans();
+}
+
+
 /** Because hash_map doesnt free its buckets when we delete items (this is a 'feature')
  * we must occasionally rehash the hash (yes really).
  * We do this by copying the entries from the old hash to a new hash, causing all
@@ -267,6 +279,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
        modules.resize(255);
        factory.resize(255);
 
+       this->unregistered_count = 0;
+
        this->clientlist = new user_hash();
        this->chanlist = new chan_hash();
 
@@ -283,7 +297,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->time_delta = 0;
        this->next_call = this->TIME + 3;
        srand(this->TIME);
-       this->Log(DEBUG,"*** InspIRCd starting up!");
+
        if (!ServerConfig::FileExists(CONFIG_FILE))
        {
                printf("ERROR: Cannot open config file: %s\nExiting...\n",CONFIG_FILE);
@@ -332,8 +346,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
 
        this->OpenLog(argv, argc);
        this->stats = new serverstats();
-       this->Parser = new CommandParser(this);
        this->Timers = new TimerManager();
+       this->Parser = new CommandParser(this);
        this->XLines = new XLineManager(this);
        Config->ClearStack();
        Config->Read(true, NULL);
@@ -393,10 +407,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
        /* Add the listening sockets used for client inbound connections
         * to the socket engine
         */
-       this->Log(DEBUG,"%d listeners",stats->BoundPortCount);
        for (unsigned long count = 0; count < stats->BoundPortCount; count++)
        {
-               this->Log(DEBUG,"Add listener: %d",Config->openSockfd[count]->GetFd());
                if (!SE->AddFd(Config->openSockfd[count]))
                {
                        printf("\nEH? Could not add listener to socketengine. You screwed up, aborting.\n");
@@ -428,7 +440,7 @@ std::string InspIRCd::GetVersionString()
        }
        else
        {
-               snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%lu,%s,%s]",VERSION,Config->ServerName,SYSTEM,(unsigned long)OPTIMISATION,SE->GetName().c_str(),dnsengine);
+               snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%s,%s,%s]",VERSION,Config->ServerName,SYSTEM,REVISION,SE->GetName().c_str(),dnsengine);
        }
        return versiondata;
 }
@@ -515,10 +527,6 @@ void InspIRCd::MoveTo(std::string modulename,int slot)
                        Config->implement_lists[slot][n] = x;
                }
        }
-       else
-       {
-               this->Log(DEBUG,"Move of %s to slot failed!",modulename.c_str());
-       }
 }
 
 void InspIRCd::MoveAfter(std::string modulename, std::string after)
@@ -684,8 +692,6 @@ bool InspIRCd::LoadModule(const char* filename)
                snprintf(MODERR,MAXBUF,"Module %s is not within the modules directory.",modfile);
                return false;
        }
-       this->Log(DEBUG,"Loading module: %s",modfile);
-
        if (ServerConfig::FileExists(modfile))
        {
 
@@ -813,7 +819,6 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
                        WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
                if ((TIME % 3600) == 0)
                {
-                       irc::whowas::MaintainWhoWas(this, TIME);
                        this->RehashUsersAndChans();
                        FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect());
                }