]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
fixed std:: stuff
[user/henk/code/inspircd.git] / src / inspircd.cpp
index f8a65aae091bf15e8040e6c304b7f0a446d0fa1f..450284d19d551470efad4d44985ea41685ecd5b0 100644 (file)
@@ -82,7 +82,7 @@ void InspIRCd::Cleanup()
        }
 
        /* Close all client sockets, or the new process inherits them */
-       for (std::vector<User*>::const_iterator i = this->local_users.begin(); i != this->local_users.end(); i++)
+       for (std::vector<User*>::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); i++)
        {
                (*i)->SetWriteError("Server shutdown");
                (*i)->CloseSocket();
@@ -156,21 +156,21 @@ void InspIRCd::ResetMaxBans()
  */
 void InspIRCd::RehashUsersAndChans()
 {
-       user_hash* old_users = this->clientlist;
-       user_hash* old_uuid  = this->uuidlist;
+       user_hash* old_users = this->Users->clientlist;
+       user_hash* old_uuid  = this->Users->uuidlist;
        chan_hash* old_chans = this->chanlist;
 
-       this->clientlist = new user_hash();
-       this->uuidlist = new user_hash();
+       this->Users->clientlist = new user_hash();
+       this->Users->uuidlist = new user_hash();
        this->chanlist = new chan_hash();
 
        for (user_hash::const_iterator n = old_users->begin(); n != old_users->end(); n++)
-               this->clientlist->insert(*n);
+               this->Users->clientlist->insert(*n);
 
        delete old_users;
 
        for (user_hash::const_iterator n = old_uuid->begin(); n != old_uuid->end(); n++)
-               this->uuidlist->insert(*n);
+               this->Users->uuidlist->insert(*n);
 
        delete old_uuid;
 
@@ -308,11 +308,14 @@ InspIRCd::InspIRCd(int argc, char** argv)
        delete SEF;
 
        this->s_signal = 0;
+       
+       // Create base manager classes early, so nothing breaks
+       this->Users = new UserManager(this);
+       
+       this->Users->unregistered_count = 0;
 
-       this->unregistered_count = 0;
-
-       this->clientlist = new user_hash();
-       this->uuidlist = new user_hash();
+       this->Users->clientlist = new user_hash();
+       this->Users->uuidlist = new user_hash();
        this->chanlist = new chan_hash();
 
        this->Res = NULL;
@@ -325,7 +328,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->Timers = new TimerManager(this);
        this->Parser = new CommandParser(this);
        this->XLines = new XLineManager(this);
-       this->Users = new UserManager(this);
 
        this->Config->argv = argv;
        this->Config->argc = argc;
@@ -431,9 +433,9 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->Modes = new ModeParser(this);
 
        /* set up fake client (uid is incorrect at this point,
-         * until after config is read. we set up the user again
-         * at that point 
-         */
+        * until after config is read. we set up the user again
+        * at that point 
+        */
        this->FakeClient = new User(this);
        this->FakeClient->SetFd(FD_MAGIC_NUMBER);
 
@@ -476,42 +478,42 @@ InspIRCd::InspIRCd(int argc, char** argv)
        /* We have all the files we can get, initiate pass 1 */
        Config->Read(true, NULL, 1);
 
-        this->AddServerName(Config->ServerName);
+       this->AddServerName(Config->ServerName);
 
-        /*
-         * Initialise SID/UID.
-         * For an explanation as to exactly how this works, and why it works this way, see GetUID().
-         *   -- w00t
-         */
-        if (*Config->sid)
-        {
+       /*
+        * Initialise SID/UID.
+        * For an explanation as to exactly how this works, and why it works this way, see GetUID().
+        *   -- w00t
+        */
+       if (*Config->sid)
+       {
        }
-        else
-        {
+       else
+       {
                // Generate one
                size_t sid = 0;
 
-                for (const char* x = Config->ServerName; *x; ++x)
-                        sid = 5 * sid + *x;
-                for (const char* y = Config->ServerDesc; *y; ++y)
-                        sid = 5 * sid + *y;
-                sid = sid % 999;
+               for (const char* x = Config->ServerName; *x; ++x)
+                       sid = 5 * sid + *x;
+               for (const char* y = Config->ServerDesc; *y; ++y)
+                       sid = 5 * sid + *y;
+               sid = sid % 999;
 
                Config->sid[0] = (char)(sid / 100 + 48);
                Config->sid[1] = (char)(((sid / 10) % 10) + 48);
                Config->sid[2] = (char)(sid % 10 + 48);
-        }
+       }
 
-        this->InitialiseUID();
+       this->InitialiseUID();
 
-        /* set up fake client again this time with the correct uid */
-        delete FakeClient;
-        this->FakeClient = new User(this);
-        this->FakeClient->SetFd(FD_MAGIC_NUMBER);
+       /* set up fake client again this time with the correct uid */
+       delete FakeClient;
+       this->FakeClient = new User(this);
+       this->FakeClient->SetFd(FD_MAGIC_NUMBER);
 
-        // Get XLine to do it's thing.
-        this->XLines->CheckELines();
-        this->XLines->ApplyLines();
+       // Get XLine to do it's thing.
+       this->XLines->CheckELines();
+       this->XLines->ApplyLines();
 
 
        CheckDie();
@@ -578,8 +580,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
        }
 #endif
 
-       printf("\nInspIRCd is now running as '%s'[%s]\n", Config->ServerName,Config->GetSID());
-       Log(DEFAULT,"Startup complete as '%s'[%s]", Config->ServerName,Config->GetSID());
+       printf("\nInspIRCd is now running as '%s'[%s]\n", Config->ServerName,Config->GetSID().c_str());
+       Log(DEFAULT,"Startup complete as '%s'[%s]", Config->ServerName,Config->GetSID().c_str());
 
        this->WritePID(Config->PID);
 }