diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-04 00:41:28 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-04 00:41:28 +0000 |
commit | c116475922dc1669d540bf2fa911c126f1dd8c40 (patch) | |
tree | be9650368047d7a595e9d2d011e873ad73b3c472 /src/helperfuncs.cpp | |
parent | 32ae5cb126d132679ca8df142a9778f6e6eaf9e2 (diff) |
This doesn't belong in userprocess.cpp. :P
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3811 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r-- | src/helperfuncs.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 4905cfabd..073b5b37c 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -61,6 +61,8 @@ extern std::vector<userrec*> all_opers; extern user_hash clientlist; extern chan_hash chanlist; +char LOG_FILE[MAXBUF]; + extern std::vector<userrec*> local_users; static char TIMESTR[26]; @@ -1791,3 +1793,84 @@ bool charremove(char* mp, char remove) return shift_down; } + +void OpenLog(char** argv, int argc) +{ + if (!*LOG_FILE) + { + if (Config->logpath == "") + { + Config->logpath = GetFullProgDir(argv,argc) + "/ircd.log"; + } + } + else + { + Config->log_file = fopen(LOG_FILE,"a+"); + + if (!Config->log_file) + { + printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str()); + Exit(ERROR); + } + + return; + } + + Config->log_file = fopen(Config->logpath.c_str(),"a+"); + + if (!Config->log_file) + { + printf("ERROR: Could not write to logfile %s, bailing!\n\n",Config->logpath.c_str()); + Exit(ERROR); + } +} + +void CheckRoot() +{ + if (geteuid() == 0) + { + printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n"); + log(DEFAULT,"InspIRCd: startup: not starting with UID 0!"); + Exit(ERROR); + } +} + +void CheckDie() +{ + if (*Config->DieValue) + { + printf("WARNING: %s\n\n",Config->DieValue); + log(DEFAULT,"Uh-Oh, somebody didn't read their config file: '%s'",Config->DieValue); + Exit(ERROR); + } +} + +/* We must load the modules AFTER initializing the socket engine, now */ +void LoadAllModules(InspIRCd* ServerInstance) +{ + char configToken[MAXBUF]; + Config->module_names.clear(); + MODCOUNT = -1; + + for (int count = 0; count < Config->ConfValueEnum("module",&Config->config_f); count++) + { + Config->ConfValue("module","name",count,configToken,&Config->config_f); + printf("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken); + + if (!ServerInstance->LoadModule(configToken)) + { + log(DEFAULT,"Exiting due to a module loader error."); + printf("\nThere was an error loading a module: %s\n\n",ServerInstance->ModuleError()); + Exit(0); + } + + if (!ServerInstance->LoadModule(configToken)) + { + log(DEFAULT,"Exiting due to a module loader error."); + printf("\nThere was an error loading a module: %s\n\n",ServerInstance->ModuleError()); + Exit(0); + } + } + + log(DEFAULT,"Total loaded modules: %lu",(unsigned long)MODCOUNT+1); +} |