- if (!ServerInstance || !ServerInstance->Config)
- return;
-
- /* If we were given -debug we output all messages, regardless of configured loglevel */
- if ((level < ServerInstance->Config->LogLevel) && !ServerInstance->Config->forcedebug)
- return;
-
- if (TIME != LAST)
- {
- struct tm *timeinfo = localtime(&TIME);
-
- strlcpy(TIMESTR,asctime(timeinfo),26);
- TIMESTR[24] = ':';
- LAST = TIME;
- }
-
- if (ServerInstance->Config->log_file && ServerInstance->Config->writelog)
- {
- fprintf(ServerInstance->Config->log_file,"%s %s\n",TIMESTR,text.c_str());
- fflush(ServerInstance->Config->log_file);
- }
-
- if (ServerInstance->Config->nofork)
- {
- printf("%s %s\n", TIMESTR, text.c_str());
- }
-}
-
-/** readfile()
- * Read the contents of a file located by `fname' into a file_cache pointed at by `F'.
- *
- * XXX - we may want to consider returning a file_cache or pointer to one, less confusing.
- */
-void readfile(file_cache &F, const char* fname)
-{
- FILE* file;
- char linebuf[MAXBUF];
-
- log(DEBUG,"readfile: loading %s",fname);
- F.clear();
- file = fopen(fname,"r");
-
- if (file)
- {
- while (!feof(file))
- {
- fgets(linebuf,sizeof(linebuf),file);
- linebuf[strlen(linebuf)-1]='\0';
-
- if (!*linebuf)
- {
- strcpy(linebuf," ");
- }
-
- if (!feof(file))
- {
- F.push_back(linebuf);
- }
- }
-
- fclose(file);
- }
- else
- {
- log(DEBUG,"readfile: failed to load file: %s",fname);
- }
-
- log(DEBUG,"readfile: loaded %s, %lu lines",fname,(unsigned long)F.size());
-}
-
-
-std::string GetServerDescription(const char* servername)
-{
- std::string description = "";