* | 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
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;
* these files.
*/
Config->Read(true, NULL, 0);
- Config->StartDownloads();
-
- /* Now the downloads are started, we monitor them for completion.
- * On completion, we call Read again with pass = 1.
- * NOTE: We really should add a timeout here
- */
-
- while (Config->Downloading())
- {
- SE->DispatchEvents();
- this->BufferedSocketCull();
- }
-
- printf("\n");
-
- if (Config->FileErrors)
- {
- for (std::map<std::string, std::istream*>::iterator x = Config->IncludedFiles.begin(); x != Config->IncludedFiles.end(); ++x)
- {
- if (!x->second)
- printf("ERROR: Failed to access the file: %s.\n", x->first.c_str());
- }
- printf("Initialisation of configuration failed.\n");
- Exit(EXIT_STATUS_CONFIG);
- }
-
+ Config->DoDownloads();
/* We have all the files we can get, initiate pass 1 */
Config->Read(true, NULL, 1);
this->AddServerName(Config->ServerName);
- /* set up fake client again this time with the correct uid */
- delete FakeClient;
- this->FakeClient = new User(this);
- this->FakeClient->SetFd(FD_MAGIC_NUMBER);
-
/*
* Initialise SID/UID.
* 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();
+ /* 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();
/* 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()
{
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)
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 */
*/
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 */
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;