1 /* ---------------------------------------------------------------------
3 * +------------------------------------+
4 * | Inspire Internet Relay Chat Daemon |
5 * +------------------------------------+
7 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
9 * <brain@chatspike.net>
10 * <Craig@chatspike.net>
12 * Written by Craig Edwards, Craig McLure, and others.
13 * This program is free but copyrighted software; you can redistribute
14 * it and/or modify it under the terms of the GNU General Public
15 * License as published by the Free Software Foundation, version 2
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 * ---------------------------------------------------------------------
31 #include "configreader.h"
46 #include "socketengine.h"
47 #include "inspircd_se_config.h"
50 #include "command_parse.h"
52 using irc::sockets::NonBlocking;
53 using irc::sockets::insp_ntoa;
54 using irc::sockets::insp_inaddr;
55 using irc::sockets::insp_sockaddr;
61 void InspIRCd::AddServerName(const std::string &servername)
63 this->Log(DEBUG,"Adding server name: %s",servername.c_str());
65 if(find(servernames.begin(), servernames.end(), servername) == servernames.end())
66 servernames.push_back(servername); /* Wasn't already there. */
69 const char* InspIRCd::FindServerNamePtr(const std::string &servername)
71 servernamelist::iterator iter = find(servernames.begin(), servernames.end(), servername);
73 if(iter == servernames.end())
75 AddServerName(servername);
76 iter = --servernames.end();
82 bool InspIRCd::FindServerName(const std::string &servername)
84 return (find(servernames.begin(), servernames.end(), servername) != servernames.end());
87 void InspIRCd::Exit(int status)
92 void InspIRCd::Start()
94 printf("\033[1;32mInspire Internet Relay Chat Server, compiled %s at %s\n",__DATE__,__TIME__);
95 printf("(C) ChatSpike Development team.\033[0m\n\n");
96 printf("Developers:\t\t\033[1;32mBrain, FrostyCoolSlug, w00t, Om, Special\033[0m\n");
97 printf("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n");
98 printf("Name concept:\t\t\033[1;32mLord_Zathras\033[0m\n\n");
101 void InspIRCd::Rehash(int status)
103 SI->WriteOpers("Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(CONFIG_FILE));
104 fclose(SI->Config->log_file);
106 SI->Config->Read(false,NULL);
107 FOREACH_MOD_I(SI,I_OnRehash,OnRehash(""));
110 void InspIRCd::SetSignals(bool SEGVHandler)
112 signal (SIGALRM, SIG_IGN);
113 signal (SIGHUP, InspIRCd::Rehash);
114 signal (SIGPIPE, SIG_IGN);
115 signal (SIGTERM, InspIRCd::Exit);
118 bool InspIRCd::DaemonSeed()
121 if ((childpid = fork ()) < 0)
123 else if (childpid > 0)
125 /* We wait a few seconds here, so that the shell prompt doesnt come back over the output */
131 printf("InspIRCd Process ID: \033[1;32m%lu\033[0m\n",(unsigned long)getpid());
134 if (getrlimit(RLIMIT_CORE, &rl) == -1)
136 this->Log(DEFAULT,"Failed to getrlimit()!");
141 rl.rlim_cur = rl.rlim_max;
142 if (setrlimit(RLIMIT_CORE, &rl) == -1)
143 this->Log(DEFAULT,"setrlimit() failed, cannot increase coredump size.");
149 void InspIRCd::WritePID(const std::string &filename)
151 std::ofstream outfile(filename.c_str());
152 if (outfile.is_open())
159 printf("Failed to write PID-file '%s', exiting.\n",filename.c_str());
160 this->Log(DEFAULT,"Failed to write PID-file '%s', exiting.",filename.c_str());
165 std::string InspIRCd::GetRevision()
170 InspIRCd::InspIRCd(int argc, char** argv)
171 : ModCount(-1), duration_m(60), duration_h(60*60), duration_d(60*60*24), duration_w(60*60*24*7), duration_y(60*60*24*365)
173 bool SEGVHandler = false;
174 //ServerInstance = this;
179 memset(fd_ref_table, 0, sizeof(fd_ref_table));
180 memset(socket_ref, 0, sizeof(socket_ref));
182 this->Config = new ServerConfig(this);
184 this->module_sockets.clear();
185 this->TIME = this->OLDTIME = this->startup_time = time(NULL);
187 this->Log(DEBUG,"*** InspIRCd starting up!");
188 if (!ServerConfig::FileExists(CONFIG_FILE))
190 printf("ERROR: Cannot open config file: %s\nExiting...\n",CONFIG_FILE);
191 this->Log(DEFAULT,"main: no config");
192 printf("ERROR: Your config file is missing, this IRCd will self destruct in 10 seconds!\n");
195 *this->LogFileName = 0;
197 for (int i = 1; i < argc; i++)
199 if (!strcmp(argv[i],"-nofork"))
201 Config->nofork = true;
203 else if(!strcmp(argv[i],"-debug"))
205 Config->forcedebug = true;
207 else if(!strcmp(argv[i],"-nolog"))
209 Config->writelog = false;
211 else if (!strcmp(argv[i],"-wait"))
215 else if (!strcmp(argv[i],"-nolimit"))
217 printf("WARNING: The `-nolimit' option is deprecated, and now on by default. This behaviour may change in the future.\n");
219 else if (!strcmp(argv[i],"-notraceback"))
223 else if (!strcmp(argv[i],"-logfile"))
227 strlcpy(LogFileName,argv[i+1],MAXBUF);
228 printf("LOG: Setting logfile to %s\n",LogFileName);
232 printf("ERROR: The -logfile parameter must be followed by a log file name and path.\n");
239 printf("Usage: %s [-nofork] [-nolog] [-debug] [-wait] [-nolimit] [-notraceback] [-logfile <filename>]\n",argv[0]);
245 strlcpy(Config->MyExecutable,argv[0],MAXBUF);
247 this->MakeLowerMap();
250 this->stats = new serverstats();
251 this->Parser = new CommandParser(this);
252 this->Timers = new TimerManager();
253 this->XLines = new XLineManager(this);
254 Config->ClearStack();
255 Config->Read(true, NULL);
257 this->Modes = new ModeParser(this);
258 this->AddServerName(Config->ServerName);
260 InitializeDisabledCommands(Config->DisabledCommands, this);
261 stats->BoundPortCount = BindPorts(true);
263 for(int t = 0; t < 255; t++)
264 Config->global_implementation[t] = 0;
266 memset(&Config->implement_lists,0,sizeof(Config->implement_lists));
269 this->SetSignals(SEGVHandler);
272 if (!this->DaemonSeed())
274 printf("ERROR: could not go into daemon mode. Shutting down.\n");
279 /* Because of limitations in kqueue on freebsd, we must fork BEFORE we
280 * initialize the socket engine.
282 SocketEngineFactory* SEF = new SocketEngineFactory();
283 SE = SEF->Create(this);
286 this->Res = new DNS(this);
288 this->Log(DEBUG,"RES: %08x",this->Res);
290 this->LoadAllModules();
292 /* Just in case no modules were loaded - fix for bug #101 */
293 this->BuildISupport();
295 if (!stats->BoundPortCount)
297 printf("\nI couldn't bind any ports! Are you sure you didn't start InspIRCd twice?\n");
301 /* Add the listening sockets used for client inbound connections
302 * to the socket engine
304 this->Log(DEBUG,"%d listeners",stats->BoundPortCount);
305 for (unsigned long count = 0; count < stats->BoundPortCount; count++)
307 this->Log(DEBUG,"Add listener: %d",Config->openSockfd[count]);
308 if (!SE->AddFd(Config->openSockfd[count],true,X_LISTEN))
310 printf("\nEH? Could not add listener to socketengine. You screwed up, aborting.\n");
322 printf("\nInspIRCd is now running!\n");
324 this->WritePID(Config->PID);
326 /* main loop, this never returns */
333 std::string InspIRCd::GetVersionString()
335 char versiondata[MAXBUF];
336 char dnsengine[] = "singlethread-object";
337 if (*Config->CustomVersion)
339 snprintf(versiondata,MAXBUF,"%s %s :%s",VERSION,Config->ServerName,Config->CustomVersion);
343 snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%lu,%s,%s]",VERSION,Config->ServerName,SYSTEM,(unsigned long)OPTIMISATION,SE->GetName().c_str(),dnsengine);
348 char* InspIRCd::ModuleError()
353 void InspIRCd::EraseFactory(int j)
356 for (std::vector<ircd_module*>::iterator t = factory.begin(); t != factory.end(); t++)
361 factory.push_back(NULL);
368 void InspIRCd::EraseModule(int j)
371 for (ModuleList::iterator m = modules.begin(); m!= modules.end(); m++)
377 modules.push_back(NULL);
383 for (std::vector<std::string>::iterator v = Config->module_names.begin(); v != Config->module_names.end(); v++)
387 Config->module_names.erase(v);
395 void InspIRCd::MoveTo(std::string modulename,int slot)
397 unsigned int v2 = 256;
398 for (unsigned int v = 0; v < Config->module_names.size(); v++)
400 if (Config->module_names[v] == modulename)
402 // found an instance, swap it with the item at the end
407 if ((v2 != (unsigned int)slot) && (v2 < 256))
409 // Swap the module names over
410 Config->module_names[v2] = Config->module_names[slot];
411 Config->module_names[slot] = modulename;
412 // now swap the module factories
413 ircd_module* temp = factory[v2];
414 factory[v2] = factory[slot];
415 factory[slot] = temp;
416 // now swap the module objects
417 Module* temp_module = modules[v2];
418 modules[v2] = modules[slot];
419 modules[slot] = temp_module;
420 // now swap the implement lists (we dont
421 // need to swap the global or recount it)
422 for (int n = 0; n < 255; n++)
424 char x = Config->implement_lists[v2][n];
425 Config->implement_lists[v2][n] = Config->implement_lists[slot][n];
426 Config->implement_lists[slot][n] = x;
431 this->Log(DEBUG,"Move of %s to slot failed!",modulename.c_str());
435 void InspIRCd::MoveAfter(std::string modulename, std::string after)
437 for (unsigned int v = 0; v < Config->module_names.size(); v++)
439 if (Config->module_names[v] == after)
441 MoveTo(modulename, v);
447 void InspIRCd::MoveBefore(std::string modulename, std::string before)
449 for (unsigned int v = 0; v < Config->module_names.size(); v++)
451 if (Config->module_names[v] == before)
455 MoveTo(modulename, v-1);
459 MoveTo(modulename, v);
466 void InspIRCd::MoveToFirst(std::string modulename)
468 MoveTo(modulename,0);
471 void InspIRCd::MoveToLast(std::string modulename)
473 MoveTo(modulename,this->GetModuleCount());
476 void InspIRCd::BuildISupport()
478 // the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
480 v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES << " CHANTYPES=# PREFIX=(ohv)@%+ MAP MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
481 v << " CASEMAPPING=rfc1459 STATUSMSG=@%+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=" << Config->MaxTargets << " AWAYLEN=";
482 v << MAXAWAY << " CHANMODES=b,k,l,psmnti FNC NETWORK=" << Config->Network << " MAXPARA=32";
483 Config->data005 = v.str();
484 FOREACH_MOD_I(this,I_On005Numeric,On005Numeric(Config->data005));
487 bool InspIRCd::UnloadModule(const char* filename)
489 std::string filename_str = filename;
490 for (unsigned int j = 0; j != Config->module_names.size(); j++)
492 if (Config->module_names[j] == filename_str)
494 if (modules[j]->GetVersion().Flags & VF_STATIC)
496 this->Log(DEFAULT,"Failed to unload STATIC module %s",filename);
497 snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)");
500 /* Give the module a chance to tidy out all its metadata */
501 for (chan_hash::iterator c = this->chanlist.begin(); c != this->chanlist.end(); c++)
503 modules[j]->OnCleanup(TYPE_CHANNEL,c->second);
505 for (user_hash::iterator u = this->clientlist.begin(); u != this->clientlist.end(); u++)
507 modules[j]->OnCleanup(TYPE_USER,u->second);
510 FOREACH_MOD_I(this,I_OnUnloadModule,OnUnloadModule(modules[j],Config->module_names[j]));
512 for(int t = 0; t < 255; t++)
514 Config->global_implementation[t] -= Config->implement_lists[j][t];
517 /* We have to renumber implement_lists after unload because the module numbers change!
519 for(int j2 = j; j2 < 254; j2++)
521 for(int t = 0; t < 255; t++)
523 Config->implement_lists[j2][t] = Config->implement_lists[j2+1][t];
528 this->Log(DEBUG,"Removing dependent commands...");
529 Parser->RemoveCommands(filename);
530 this->Log(DEBUG,"Deleting module...");
531 this->EraseModule(j);
532 this->Log(DEBUG,"Erasing module entry...");
533 this->EraseFactory(j);
534 this->Log(DEFAULT,"Module %s unloaded",filename);
540 this->Log(DEFAULT,"Module %s is not loaded, cannot unload it!",filename);
541 snprintf(MODERR,MAXBUF,"Module not loaded");
545 bool InspIRCd::LoadModule(const char* filename)
547 char modfile[MAXBUF];
549 strlcpy(modfile,filename,MAXBUF);
551 snprintf(modfile,MAXBUF,"%s/%s",Config->ModPath,filename);
553 std::string filename_str = filename;
556 if (!ServerConfig::DirValid(modfile))
558 this->Log(DEFAULT,"Module %s is not within the modules directory.",modfile);
559 snprintf(MODERR,MAXBUF,"Module %s is not within the modules directory.",modfile);
564 this->Log(DEBUG,"Loading module: %s",modfile);
566 if (ServerConfig::FileExists(modfile))
569 for (unsigned int j = 0; j < Config->module_names.size(); j++)
571 if (Config->module_names[j] == filename_str)
573 this->Log(DEFAULT,"Module %s is already loaded, cannot load a module twice!",modfile);
574 snprintf(MODERR,MAXBUF,"Module already loaded");
580 ircd_module* a = new ircd_module(this, modfile);
581 factory[this->ModCount+1] = a;
582 if (factory[this->ModCount+1]->LastError())
584 this->Log(DEFAULT,"Unable to load %s: %s",modfile,factory[this->ModCount+1]->LastError());
585 snprintf(MODERR,MAXBUF,"Loader/Linker error: %s",factory[this->ModCount+1]->LastError());
588 if ((long)factory[this->ModCount+1]->factory != -1)
590 Module* m = factory[this->ModCount+1]->factory->CreateModule(this);
591 modules[this->ModCount+1] = m;
592 /* save the module and the module's classfactory, if
593 * this isnt done, random crashes can occur :/ */
594 Config->module_names.push_back(filename);
596 char* x = &Config->implement_lists[this->ModCount+1][0];
597 for(int t = 0; t < 255; t++)
600 modules[this->ModCount+1]->Implements(x);
602 for(int t = 0; t < 255; t++)
603 Config->global_implementation[t] += Config->implement_lists[this->ModCount+1][t];
607 this->Log(DEFAULT,"Unable to load %s",modfile);
608 snprintf(MODERR,MAXBUF,"Factory function failed: Probably missing init_module() entrypoint.");
612 catch (ModuleException& modexcept)
614 this->Log(DEFAULT,"Unable to load %s: ",modfile,modexcept.GetReason());
615 snprintf(MODERR,MAXBUF,"Factory function threw an exception: %s",modexcept.GetReason());
622 this->Log(DEFAULT,"InspIRCd: startup: Module Not Found %s",modfile);
623 snprintf(MODERR,MAXBUF,"Module file could not be found");
628 FOREACH_MOD_I(this,I_OnLoadModule,OnLoadModule(modules[this->ModCount],filename_str));
629 // now work out which modules, if any, want to move to the back of the queue,
630 // and if they do, move them there.
631 std::vector<std::string> put_to_back;
632 std::vector<std::string> put_to_front;
633 std::map<std::string,std::string> put_before;
634 std::map<std::string,std::string> put_after;
635 for (unsigned int j = 0; j < Config->module_names.size(); j++)
637 if (modules[j]->Prioritize() == PRIORITY_LAST)
639 put_to_back.push_back(Config->module_names[j]);
641 else if (modules[j]->Prioritize() == PRIORITY_FIRST)
643 put_to_front.push_back(Config->module_names[j]);
645 else if ((modules[j]->Prioritize() & 0xFF) == PRIORITY_BEFORE)
647 put_before[Config->module_names[j]] = Config->module_names[modules[j]->Prioritize() >> 8];
649 else if ((modules[j]->Prioritize() & 0xFF) == PRIORITY_AFTER)
651 put_after[Config->module_names[j]] = Config->module_names[modules[j]->Prioritize() >> 8];
654 for (unsigned int j = 0; j < put_to_back.size(); j++)
656 MoveToLast(put_to_back[j]);
658 for (unsigned int j = 0; j < put_to_front.size(); j++)
660 MoveToFirst(put_to_front[j]);
662 for (std::map<std::string,std::string>::iterator j = put_before.begin(); j != put_before.end(); j++)
664 MoveBefore(j->first,j->second);
666 for (std::map<std::string,std::string>::iterator j = put_after.begin(); j != put_after.end(); j++)
668 MoveAfter(j->first,j->second);
674 void InspIRCd::DoOneIteration(bool process_module_sockets)
676 int activefds[MAX_DESCRIPTORS];
680 InspSocket* s = NULL;
681 InspSocket* s_del = NULL;
682 unsigned int numberactive;
683 insp_sockaddr sock_us; // our port number
684 socklen_t uslen; // length of our port number
686 /* time() seems to be a pretty expensive syscall, so avoid calling it too much.
687 * Once per loop iteration is pleanty.
692 /* Run background module timers every few seconds
693 * (the docs say modules shouldnt rely on accurate
694 * timing using this event, so we dont have to
695 * time this exactly).
697 if (((TIME % 5) == 0) && (!expire_run))
699 XLines->expire_lines();
700 if (process_module_sockets)
702 FOREACH_MOD_I(this,I_OnBackgroundTimer,OnBackgroundTimer(TIME));
704 Timers->TickMissedTimers(TIME);
708 else if ((TIME % 5) == 1)
713 if (iterations++ == 15)
716 this->DoBackgroundUserStuff(TIME);
719 /* Once a second, do the background processing */
723 WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
724 if ((TIME % 3600) == 0)
726 irc::whowas::MaintainWhoWas(TIME);
730 /* Process timeouts on module sockets each time around
731 * the loop. There shouldnt be many module sockets, at
732 * most, 20 or so, so this won't be much of a performance
735 if (process_module_sockets)
736 this->DoSocketTimeouts(TIME);
738 Timers->TickTimers(TIME);
740 /* Call the socket engine to wait on the active
741 * file descriptors. The socket engine has everything's
742 * descriptors in its list... dns, modules, users,
743 * servers... so its nice and easy, just one call.
745 if (!(numberactive = SE->Wait(activefds)))
749 * Now process each of the fd's. For users, we have a fast
750 * lookup table which can find a user by file descriptor, so
751 * processing them by fd isnt expensive. If we have a lot of
752 * listening ports or module sockets though, things could get
755 this->Log(DEBUG,"There are %d fd's to process.",numberactive);
757 for (unsigned int activefd = 0; activefd < numberactive; activefd++)
759 int socket_type = SE->GetType(activefds[activefd]);
764 this->Log(DEBUG,"Type: X_ESTAB_CLIENT: fd=%d",activefds[activefd]);
765 cu = this->fd_ref_table[activefds[activefd]];
767 this->ProcessUser(cu);
773 this->Log(DEBUG,"Type: X_ESTAB_MODULE: fd=%d",activefds[activefd]);
775 if (!process_module_sockets)
778 /* Process module-owned sockets.
779 * Modules are encouraged to inherit their sockets from
780 * InspSocket so we can process them neatly like this.
782 s = this->socket_ref[activefds[activefd]];
784 if ((s) && (!s->Poll()))
786 this->Log(DEBUG,"Socket poll returned false, close and bail");
787 SE->DelFd(s->GetFd());
788 this->socket_ref[activefds[activefd]] = NULL;
789 for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
792 if ((s_del) && (s_del->GetFd() == activefds[activefd]))
794 module_sockets.erase(a);
803 this->Log(DEBUG,"WTF, X_ESTAB_MODULE for nonexistent InspSocket, removed!");
804 SE->DelFd(s->GetFd());
809 /* Handles instances of the Resolver class,
810 * a simple class extended by modules and the core for
811 * nonblocking resolving of addresses.
813 this->Res->MarshallReads(activefds[activefd]);
818 this->Log(DEBUG,"Type: X_LISTEN: fd=%d",activefds[activefd]);
820 /* It's a listener */
821 uslen = sizeof(sock_us);
822 length = sizeof(client);
823 incomingSockfd = accept (activefds[activefd],(struct sockaddr*)&client,&length);
825 if ((incomingSockfd > -1) && (!getsockname(incomingSockfd,(sockaddr*)&sock_us,&uslen)))
828 in_port = ntohs(sock_us.sin6_port);
830 in_port = ntohs(sock_us.sin_port);
832 this->Log(DEBUG,"Accepted socket %d",incomingSockfd);
833 /* Years and years ago, we used to resolve here
834 * using gethostbyaddr(). That is sucky and we
835 * don't do that any more...
837 NonBlocking(incomingSockfd);
838 if (Config->GetIOHook(in_port))
843 Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, insp_ntoa(client.sin6_addr), in_port);
845 Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, insp_ntoa(client.sin_addr), in_port);
848 catch (ModuleException& modexcept)
850 this->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason());
853 stats->statsAccept++;
855 this->Log(DEBUG,"Add ipv6 client");
856 userrec::AddClient(this, incomingSockfd, in_port, false, client.sin6_addr);
858 this->Log(DEBUG,"Add ipv4 client");
859 userrec::AddClient(this, incomingSockfd, in_port, false, client.sin_addr);
861 this->Log(DEBUG,"Adding client on port %d fd=%d",in_port,incomingSockfd);
865 this->Log(DEBUG,"Accept failed on fd %d: %s",incomingSockfd,strerror(errno));
866 shutdown(incomingSockfd,2);
867 close(incomingSockfd);
868 stats->statsRefused++;
873 /* Something went wrong if we're in here.
874 * In fact, so wrong, im not quite sure
875 * what we would do, so for now, its going
876 * to safely do bugger all.
878 this->Log(DEBUG,"Type: X_WHAT_THE_FUCK_BBQ: fd=%d",activefds[activefd]);
879 SE->DelFd(activefds[activefd]);
885 bool InspIRCd::IsIdent(const char* n)
890 for (char* i = (char*)n; *i; i++)
892 if ((*i >= 'A') && (*i <= '}'))
896 if (((*i >= '0') && (*i <= '9')) || (*i == '-') || (*i == '.'))
906 bool InspIRCd::IsNick(const char* n)
912 for (char* i = (char*)n; *i; i++, p++)
914 /* "A"-"}" can occur anywhere in a nickname */
915 if ((*i >= 'A') && (*i <= '}'))
919 /* "0"-"9", "-" can occur anywhere BUT the first char of a nickname */
920 if ((((*i >= '0') && (*i <= '9')) || (*i == '-')) && (i > n))
924 /* invalid character! abort */
927 return (p < NICKMAX - 1);
934 DoOneIteration(true);
936 /* This is never reached -- we hope! */
940 /**********************************************************************************/
943 * An ircd in four lines! bwahahaha. ahahahahaha. ahahah *cough*.
946 int main(int argc, char** argv)
948 SI = new InspIRCd(argc, argv);
954 /* this returns true when all modules are satisfied that the user should be allowed onto the irc server
955 * (until this returns true, a user will block in the waiting state, waiting to connect up to the
956 * registration timeout maximum seconds)
958 bool InspIRCd::AllModulesReportReady(userrec* user)
960 if (!Config->global_implementation[I_OnCheckReady])
963 for (int i = 0; i <= this->GetModuleCount(); i++)
965 if (Config->implement_lists[i][I_OnCheckReady])
967 int res = modules[i]->OnCheckReady(user);
975 int InspIRCd::GetModuleCount()
977 return this->ModCount;
980 time_t InspIRCd::Time()