MaxConn = SOMAXCONN;
MaxWhoResults = 100;
debugging = 0;
+ MaxChans = 20;
+ OperMaxChans = 30;
LogLevel = DEFAULT;
maxbans.clear();
}
{"options", "syntaxhints", "0", new ValueContainerBool (&this->SyntaxHints), DT_BOOLEAN, NoValidation},
{"options", "cyclehosts", "0", new ValueContainerBool (&this->CycleHosts), DT_BOOLEAN, NoValidation},
{"options", "ircumsgprefix","0", new ValueContainerBool (&this->UndernetMsgPrefix), DT_BOOLEAN, NoValidation},
+ {"options", "announceinvites", "1", new ValueContainerBool (&this->AnnounceInvites), DT_BOOLEAN, NoValidation},
+ {"options", "hostintopic", "1", new ValueContainerBool (&this->FullHostInTopic), DT_BOOLEAN, NoValidation},
{"pid", "file", "", new ValueContainerChar (this->PID), DT_CHARPTR, NoValidation},
{"whowas", "groupsize", "10", new ValueContainerInt (&this->WhoWasGroupSize), DT_INTEGER, NoValidation},
{"whowas", "maxgroups", "10240", new ValueContainerInt (&this->WhoWasMaxGroups), DT_INTEGER, NoValidation},
{"whowas", "maxkeep", "3600", new ValueContainerChar (maxkeep), DT_CHARPTR, ValidateWhoWas},
{"die", "value", "", new ValueContainerChar (this->DieValue), DT_CHARPTR, NoValidation},
+ {"channels", "users", "20", new ValueContainerUInt (&this->MaxChans), DT_INTEGER, NoValidation},
+ {"channels", "opers", "60", new ValueContainerUInt (&this->OperMaxChans), DT_INTEGER, NoValidation},
{NULL}
};
ServerInstance->Log(DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
}
+
+ if (user)
+ user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick);
+ else
+ ServerInstance->WriteOpers("*** Successfully rehashed server.");
}
bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::ostringstream &errorstream)
{
/* Leaves us with just the path */
std::string newfile = confpath.substr(0, pos) + std::string("/") + fname;
+ if (!FileExists(newfile.c_str()))
+ return false;
file = fopen(newfile.c_str(), "r");
}
}
else
+ {
+ if (!FileExists(fname))
+ return false;
file = fopen(fname, "r");
+ }
if (file)
{
bool ServerConfig::FileExists(const char* file)
{
+ struct stat sb;
+ if (stat(file, &sb) == -1)
+ return false;
+
+ if ((sb.st_mode & S_IFDIR) > 0)
+ return false;
+
FILE *input;
if ((input = fopen (file, "r")) == NULL)
- {
return false;
- }
else
{
fclose(input);
bool ServerConfig::DirValid(const char* dirandfile)
{
- char work[MAXBUF];
- char buffer[MAXBUF];
- char otherdir[MAXBUF];
+ char work[1024];
+ char buffer[1024];
+ char otherdir[1024];
int p;
- strlcpy(work, dirandfile, MAXBUF);
+ strlcpy(work, dirandfile, 1024);
p = strlen(work);
// we just want the dir
}
// Get the current working directory
- if (getcwd(buffer, MAXBUF ) == NULL )
+ if (getcwd(buffer, 1024 ) == NULL )
return false;
if (chdir(work) == -1)
return false;
- if (getcwd(otherdir, MAXBUF ) == NULL )
+ if (getcwd(otherdir, 1024 ) == NULL )
return false;
if (chdir(buffer) == -1)
std::string ServerConfig::GetFullProgDir(char** argv, int argc)
{
- char work[MAXBUF];
- char buffer[MAXBUF];
- char otherdir[MAXBUF];
+ char work[1024];
+ char buffer[1024];
+ char otherdir[1024];
int p;
- strlcpy(work,argv[0],MAXBUF);
+ strlcpy(work,argv[0],1024);
p = strlen(work);
// we just want the dir
}
// Get the current working directory
- if (getcwd(buffer, MAXBUF) == NULL)
+ if (getcwd(buffer, 1024) == NULL)
return "";
if (chdir(work) == -1)
return "";
- if (getcwd(otherdir, MAXBUF) == NULL)
+ if (getcwd(otherdir, 1024) == NULL)
return "";
if (chdir(buffer) == -1)