From 9432f3f0e8e4e1d20123a58012f51d832b737293 Mon Sep 17 00:00:00 2001 From: "Naram Qashat cyberbotx@cyberbotx.com" Date: Sat, 18 Oct 2008 21:49:38 +0000 Subject: Started botserv block in new config, added nick and description directives. Added ValidateBotServ function to validate certain BotServ directives only when BotServ is in use. Added forward declaration of NickCore in account.h. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1451 5417fbe8-f217-4b02-8779-1006273d7864 --- src/config.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/config.c b/src/config.c index 2b2613653..63f969d4a 100644 --- a/src/config.c +++ b/src/config.c @@ -483,6 +483,16 @@ bool ValidateBantype(ServerConfig *, const char *, const char *, ValueItem &data return true; } +bool ValidateBotServ(ServerConfig *, const char *tag, const char *value, ValueItem &data) +{ + if (s_BotServ) { + if (static_cast(value) == "description") { + if (!*data.GetString()) throw ConfigException(static_cast("The value for <") + tag + ":" + value + "> cannot be empty when BotServ 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()); @@ -600,6 +610,8 @@ int ServerConfig::Read(bool bail) {"memoserv", "senddelay", "0", new ValueContainerTime(&MSSendDelay), DT_TIME, NoValidation}, {"memoserv", "notifyall", "no", new ValueContainerBool(&MSNotifyAll), DT_BOOLEAN, NoValidation}, {"memoserv", "memoreceipt", "0", new ValueContainerInt(&MSMemoReceipt), DT_INTEGER, NoValidation}, + {"botserv", "nick", "", new ValueContainerChar(&s_BotServ), DT_CHARPTR, NoValidation}, + {"botserv", "description", "Bot Service", new ValueContainerChar(&desc_BotServ), DT_CHARPTR, ValidateBotServ}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1181,8 +1193,6 @@ Directive directives[] = { {"BadPassTimeout", {{PARAM_TIME, PARAM_RELOAD, &BadPassTimeout}}}, {"BotCoreModules", {{PARAM_STRING, PARAM_RELOAD, &BotCoreModules}}}, {"BotServDB", {{PARAM_STRING, PARAM_RELOAD, &BotDBName}}}, - {"BotServName", {{PARAM_STRING, 0, &s_BotServ}, - {PARAM_STRING, 0, &desc_BotServ}}}, {"BSBadWordsMax", {{PARAM_POSINT, PARAM_RELOAD, &BSBadWordsMax}}}, {"BSDefDontKickOps", {{PARAM_SET, PARAM_RELOAD, &BSDefDontKickOps}}}, {"BSDefDontKickVoices", -- cgit