dns_timeout = DieDelay = 5;
MaxTargets = 20;
NetBufferSize = 10240;
- SoftLimit = MAXCLIENTS;
+ SoftLimit = Instance->SE->GetMaxFds();
MaxConn = SOMAXCONN;
MaxWhoResults = 0;
debugging = 0;
include_stack.clear();
}
-Module* ServerConfig::GetIOHook(int port)
-{
- std::map<int,Module*>::iterator x = IOHookModule.find(port);
- return (x != IOHookModule.end() ? x->second : NULL);
-}
-
Module* ServerConfig::GetIOHook(BufferedSocket* is)
{
std::map<BufferedSocket*,Module*>::iterator x = SocketIOHookModule.find(is);
return (x != SocketIOHookModule.end() ? x->second : NULL);
}
-bool ServerConfig::AddIOHook(int port, Module* iomod)
-{
- if (!GetIOHook(port))
- {
- IOHookModule[port] = iomod;
- return true;
- }
- else
- {
- throw ModuleException("Port already hooked by another module");
- return false;
- }
-}
-
bool ServerConfig::AddIOHook(Module* iomod, BufferedSocket* is)
{
if (!GetIOHook(is))
}
}
-bool ServerConfig::DelIOHook(int port)
-{
- std::map<int,Module*>::iterator x = IOHookModule.find(port);
- if (x != IOHookModule.end())
- {
- IOHookModule.erase(x);
- return true;
- }
- return false;
-}
-
bool ServerConfig::DelIOHook(BufferedSocket* is)
{
std::map<BufferedSocket*,Module*>::iterator x = SocketIOHookModule.find(is);
bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
- if ((data.GetInteger() < 1) || (data.GetInteger() > MAXCLIENTS))
+ if ((data.GetInteger() < 1) || (data.GetInteger() > conf->GetInstance()->SE->GetMaxFds()))
{
- conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS);
- data.Set(MAXCLIENTS);
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",conf->GetInstance()->SE->GetMaxFds(),conf->GetInstance()->SE->GetMaxFds());
+ data.Set(conf->GetInstance()->SE->GetMaxFds());
}
return true;
}
ServerInstance->SNO->WriteToSnoMask('A', "There were errors in the configuration file:");
while (start < errors.length())
{
- ServerInstance->SNO->WriteToSnoMask('A', errors.substr(start, 360).c_str());
+ ServerInstance->SNO->WriteToSnoMask('A', errors.substr(start, 360));
start += 360;
}
}
/* These tags can occur ONCE or not at all */
InitialConfig Values[] = {
- {"options", "softlimit", MAXCLIENTS_S, new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit},
+ {"options", "softlimit", "0", new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit},
{"options", "somaxconn", SOMAXCONN_S, new ValueContainerInt (&this->MaxConn), DT_INTEGER, ValidateMaxConn},
{"options", "moronbanner", "Youre banned!", new ValueContainerChar (this->MoronBanner), DT_CHARPTR, NoValidation},
{"server", "name", "", new ValueContainerChar (this->ServerName), DT_HOSTNAME|DT_BOOTONLY, ValidateServerName},
InitTypes, DoType, DoneClassesAndTypes},
{"class",
- {"name", "commands", NULL},
- {"", "", NULL},
- {DT_NOSPACES, DT_CHARPTR},
+ {"name", "commands", "usermodes", "chanmodes", NULL},
+ {"", "", "", "", NULL},
+ {DT_NOSPACES, DT_CHARPTR, DT_CHARPTR, DT_CHARPTR},
InitClasses, DoClass, DoneClassesAndTypes},
{NULL,
// write once here, to try it out and make sure its ok
ServerInstance->WritePID(this->PID);
- ServerInstance->Log(DEFAULT,"Done reading configuration file.");
-
/* Switch over logfiles */
ServerInstance->Logs->CloseLogs();
ServerInstance->Logs->OpenFileLogs();
+ ServerInstance->Logs->Log("CONFIG", DEFAULT, "Done reading configuration file.");
+
/* If we're rehashing, let's load any new modules, and unload old ones
*/
if (!bail)
}
}
- 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());
+ ServerInstance->Logs->Log("CONFIG", 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());
ServerInstance->Threads->Mutex(false);
{
for (operclass_t::iterator n = conf->operclass.begin(); n != conf->operclass.end(); n++)
{
- if (n->second)
- delete[] n->second;
+ if (n->second.commandlist)
+ delete[] n->second.commandlist;
+ if (n->second.cmodelist)
+ delete[] n->second.cmodelist;
+ if (n->second.umodelist)
+ delete[] n->second.umodelist;
}
}
/*
* XXX should this be in a class? -- w00t
*/
-bool DoClass(ServerConfig* conf, const char*, char**, ValueList &values, int*)
+bool DoClass(ServerConfig* conf, const char* tag, char**, ValueList &values, int*)
{
const char* ClassName = values[0].GetString();
const char* CommandList = values[1].GetString();
+ const char* UModeList = values[2].GetString();
+ const char* CModeList = values[3].GetString();
+
+ for (const char* c = UModeList; *c; ++c)
+ {
+ if ((*c < 'A' || *c > 'z') && *c != '*')
+ {
+ throw CoreException("Character " + std::string(1, *c) + " is not a valid mode in <class:usermodes>");
+ }
+ }
+ for (const char* c = CModeList; *c; ++c)
+ {
+ if ((*c < 'A' || *c > 'z') && *c != '*')
+ {
+ throw CoreException("Character " + std::string(1, *c) + " is not a valid mode in <class:chanmodes>");
+ }
+ }
- conf->operclass[ClassName] = strnewdup(CommandList);
+ conf->operclass[ClassName].commandlist = strnewdup(CommandList);
+ conf->operclass[ClassName].umodelist = strnewdup(UModeList);
+ conf->operclass[ClassName].cmodelist = strnewdup(CModeList);
return true;
}