1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 19:36:37 +02:00

Started hostserv block in new config, added nick and descriotion directives to it.

Added ValidateHostServ function to validate certain HostServ directives only when HostServ is in use.


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1461 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Naram Qashat cyberbotx@cyberbotx.com
2008-10-23 02:15:11 +00:00
parent 2e2767a97d
commit 076c1229fd
2 changed files with 33 additions and 3 deletions
+21
View File
@@ -580,3 +580,24 @@ botserv
*/
#fantasycharacter = "!"
}
/*
* [OPTIONAL] HostServ Config
*
* This section is used to set up the vHost Service pseudo-client. The block is optional and can be
* removed if you do not wish to have HostServ on your network. Unless specified otherwise,
* all directives are required if you do wish to use HostServ.
*/
hostserv
{
/*
* The nickname of the HostServ client.
*/
nick = "HostServ"
/*
* The description of the HostServ client, which will be used as the GECOS (real
* name) of the client.
*/
description = "vHost Service"
}
+12 -3
View File
@@ -492,6 +492,16 @@ bool ValidateBotServ(ServerConfig *, const char *tag, const char *value, ValueIt
return true;
}
bool ValidateHostServ(ServerConfig *, const char *tag, const char *value, ValueItem &data)
{
if (s_HostServ) {
if (static_cast<std::string>(value) == "description" || static_cast<std::string>(value) == "database") {
if (!*data.GetString()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> cannot be empty when HostServ is enabled!");
}
}
return true;
}
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail)
{
alog("There were errors in your configuration file: %s", errormessage.c_str());
@@ -620,6 +630,8 @@ int ServerConfig::Read(bool bail)
{"botserv", "gentlebadwordreason", "no", new ValueContainerBool(&BSGentleBWReason), DT_BOOLEAN, NoValidation},
{"botserv", "casesensitive", "no", new ValueContainerBool(&BSCaseSensitive), DT_BOOLEAN, NoValidation},
{"botserv", "fantasycharacter", "!", new ValueContainerChar(&BSFantasyCharacter), DT_BOOLEAN, NoValidation},
{"hostserv", "nick", "", new ValueContainerChar(&s_HostServ), DT_CHARPTR, NoValidation},
{"hostserv", "description", "vHost Service", new ValueContainerChar(&desc_HostServ), DT_CHARPTR, ValidateHostServ},
{NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation}
};
/* These tags can occur multiple times, and therefore they have special code to read them
@@ -1201,8 +1213,6 @@ Directive directives[] = {
{"BadPassTimeout", {{PARAM_TIME, PARAM_RELOAD, &BadPassTimeout}}},
{"BotCoreModules", {{PARAM_STRING, PARAM_RELOAD, &BotCoreModules}}},
{"HostServDB", {{PARAM_STRING, PARAM_RELOAD, &HostDBName}}},
{"HostServName", {{PARAM_STRING, 0, &s_HostServ},
{PARAM_STRING, 0, &desc_HostServ}}},
{"ChanCoreModules", {{PARAM_STRING, PARAM_RELOAD, &ChanCoreModules}}},
{"DefSessionLimit", {{PARAM_POSINT, 0, &DefSessionLimit}}},
{"DisableRaw", {{PARAM_SET, PARAM_RELOAD, &DisableRaw}}},
@@ -1904,7 +1914,6 @@ int read_config(int reload)
}
if (s_HostServ) {
CHEK2(s_HostServ, HostServName);
CHEK2(HostDBName, HostServDB);
}