X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspircd.cpp;h=2f00b9f2e7cb3e5278a1a3c955ed57d9a9ab26d7;hb=21f9acdb6c5c35b26d926f75845135f16c3c54e9;hp=d1693881837775eebd5a97ff36b19f9159c64b3c;hpb=b57c7f4e466f72fdd2ac3deca42caa1ea7748338;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspircd.cpp b/src/inspircd.cpp index d16938818..2f00b9f2e 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -11,6 +11,8 @@ * --------------------------------------------------- */ +/* $Install: src/inspircd $(BINPATH) */ + #include "inspircd.h" #include @@ -322,7 +324,14 @@ InspIRCd::InspIRCd(int argc, char** argv) this->uuidlist = new user_hash(); this->chanlist = new chan_hash(); + this->Config = new ServerConfig(this); + this->SNO = new SnomaskManager(this); + this->Modules = new ModuleManager(this); + this->stats = new serverstats(); + this->Timers = new TimerManager(this); + this->Parser = new CommandParser(this); + this->XLines = new XLineManager(this); this->Config->argv = argv; this->Config->argc = argc; @@ -335,10 +344,9 @@ InspIRCd::InspIRCd(int argc, char** argv) this->Config->opertypes.clear(); this->Config->operclass.clear(); - this->SNO = new SnomaskManager(this); + this->TIME = this->OLDTIME = this->startup_time = time(NULL); this->time_delta = 0; - this->next_call = this->TIME + 3; srand(this->TIME); *this->LogFileName = 0; @@ -424,16 +432,13 @@ InspIRCd::InspIRCd(int argc, char** argv) /* Set the finished argument values */ Config->nofork = do_nofork; Config->forcedebug = do_debug; - Config->writelog = !do_nolog; - - this->Modules = new ModuleManager(this); - this->stats = new serverstats(); - this->Timers = new TimerManager(this); - this->Parser = new CommandParser(this); - this->XLines = new XLineManager(this); - + Config->writelog = !do_nolog; Config->ClearStack(); Config->Read(true, NULL); + + // Get XLine to do it's thing. + this->XLines->CheckELines(this->XLines->lookup_lines['E']); + this->XLines->ApplyLines(); this->Modules->modules.resize(255); this->Modules->handles.resize(255); @@ -615,14 +620,18 @@ int InspIRCd::Run() if (TIME != OLDTIME) { if (TIME < OLDTIME) + { WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME)); + } + if ((TIME % 3600) == 0) { this->RehashUsersAndChans(); FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect()); } + Timers->TickTimers(TIME); - this->DoBackgroundUserStuff(TIME); + this->DoBackgroundUserStuff(); if ((TIME % 5) == 0) { @@ -664,7 +673,7 @@ int InspIRCd::Run() this->GlobalCulls.Apply(); /* If any inspsockets closed, remove them */ - this->InspSocketCull(); + this->BufferedSocketCull(); if (this->s_signal) { @@ -676,9 +685,9 @@ int InspIRCd::Run() return 0; } -void InspIRCd::InspSocketCull() +void InspIRCd::BufferedSocketCull() { - for (std::map::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x) + for (std::map::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x) { SE->DelFd(x->second); x->second->Close(); @@ -690,10 +699,10 @@ void InspIRCd::InspSocketCull() /**********************************************************************************/ /** - * An ircd in four lines! bwahahaha. ahahahahaha. ahahah *cough*. + * An ircd in five lines! bwahahaha. ahahahahaha. ahahah *cough*. */ -int ircd(int argc, char ** argv) +int main(int argc, char ** argv) { SI = new InspIRCd(argc, argv); mysig = &SI->s_signal; @@ -702,21 +711,6 @@ int ircd(int argc, char ** argv) return 0; } -#ifdef WINDOWS - -int main(int argc, char ** argv) -{ - ircd(argc,argv); - return 0; -} - -#else -int main(int argc, char** argv) -{ - return ircd(argc,argv); -} -#endif - /* this returns true when all modules are satisfied that the user should be allowed onto the irc server * (until this returns true, a user will block in the waiting state, waiting to connect up to the * registration timeout maximum seconds)