1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 17:13:13 +02:00

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
This commit is contained in:
Naram Qashat cyberbotx@cyberbotx.com
2008-10-18 21:49:38 +00:00
parent fdea510668
commit 9432f3f0e8
3 changed files with 35 additions and 2 deletions
+21
View File
@@ -487,3 +487,24 @@ memoserv
*/
#memoreceipt = 1
}
/*
* [OPTIONAL] BotServ Config
*
* This section is used to set up the Bot Service pseudo-client. The block is optional and can be
* removed if you do not wish to have BotServ on your network. Unless specified otherwise,
* all directives are required if you do wish to use BotServ.
*/
botserv
{
/*
* The nickname of the BotServ client.
*/
nick = "BotServ"
/*
* The description of the BotServ client, which will be used as the GECOS (real
* name) of the client.
*/
description = "Bot Service"
}
+2
View File
@@ -15,6 +15,8 @@ class NickRequest
time_t lastmail; /* Unsaved */
};
class NickCore;
class NickAlias
{
public:
+12 -2
View File
@@ -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<std::string>(value) == "description") {
if (!*data.GetString()) throw ConfigException(static_cast<std::string>("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",