]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Win32 compilation fixes
[user/henk/code/inspircd.git] / src / inspircd.cpp
index fbb7c7e71a6f0ed44cec3d6426fee472f267deb2..5bf287298ba131d4d6200b6b37d8f6b9603ba3b7 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -325,6 +325,7 @@ 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;
@@ -482,21 +483,23 @@ InspIRCd::InspIRCd(int argc, char** argv)
          * For an explanation as to exactly how this works, and why it works this way, see GetUID().
          *   -- w00t
          */
-        /* Generate SID */
-        size_t sid = 0;
-        if (Config->sid)
+        if (*Config->sid)
         {
-                sid = Config->sid;
-        }
+       }
         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;
 
-                Config->sid = sid;
+               Config->sid[0] = (char)(sid / 100 + 48);
+               Config->sid[1] = (char)(((sid / 10) % 10) + 48);
+               Config->sid[2] = (char)(sid % 10 + 48);
         }
 
         this->InitialiseUID();
@@ -584,16 +587,17 @@ InspIRCd::InspIRCd(int argc, char** argv)
 /* moved to a function, as UID generation can call this also */
 void InspIRCd::InitialiseUID()
 {
-       int i;
-       size_t sid = Config->sid;
+       int i = 3;
 
-       current_uid[0] = sid / 100 + 48;
-       current_uid[1] = ((sid / 10) % 10) + 48;
-       current_uid[2] = sid % 10 + 48;
+       current_uid[0] = Config->sid[0];
+       current_uid[1] = Config->sid[1];
+       current_uid[2] = Config->sid[2];
 
        /* Initialise UID */
        for(i = 3; i < UUID_LENGTH - 1; i++)
                current_uid[i] = 'A';
+
+       current_uid[UUID_LENGTH] = '\0';
 }
 
 int InspIRCd::Run()
@@ -623,7 +627,7 @@ int InspIRCd::Run()
                {
                        if (TIME < OLDTIME)
                        {
-                               WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
+                               SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
                        }
 
                        if ((TIME % 3600) == 0)
@@ -638,7 +642,7 @@ int InspIRCd::Run()
                        if ((TIME % 5) == 0)
                        {
                                FOREACH_MOD_I(this,I_OnBackgroundTimer,OnBackgroundTimer(TIME));
-                               Timers->TickMissedTimers(TIME);
+                               SNO->FlushSnotices();
                        }
 #ifndef WIN32
                        /* Same change as in cmd_stats.cpp, use RUSAGE_SELF rather than '0' -- Om */
@@ -670,7 +674,7 @@ int InspIRCd::Run()
                 */
                this->SE->DispatchEvents();
 
-               /* if any users was quit, take them out */
+               /* if any users were quit, take them out */
                this->GlobalCulls.Apply();
 
                /* If any inspsockets closed, remove them */
@@ -744,24 +748,6 @@ int InspIRCd::SetTimeDelta(int delta)
        return old;
 }
 
-void InspIRCd::AddLocalClone(User* user)
-{
-       clonemap::iterator x = local_clones.find(user->GetIPString());
-       if (x != local_clones.end())
-               x->second++;
-       else
-               local_clones[user->GetIPString()] = 1;
-}
-
-void InspIRCd::AddGlobalClone(User* user)
-{
-       clonemap::iterator y = global_clones.find(user->GetIPString());
-       if (y != global_clones.end())
-               y->second++;
-       else
-               global_clones[user->GetIPString()] = 1;
-}
-
 int InspIRCd::GetTimeDelta()
 {
        return time_delta;