diff options
author | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-18 21:49:38 +0000 |
---|---|---|
committer | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-18 21:49:38 +0000 |
commit | 9432f3f0e8e4e1d20123a58012f51d832b737293 (patch) | |
tree | a1f230dcc14cc131709e67bd64488ef0690a5539 | |
parent | fdea510668b60f7c4aa0e9cfde5b9f93b6e1510b (diff) |
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
-rw-r--r-- | data/example_new.conf | 21 | ||||
-rw-r--r-- | include/account.h | 2 | ||||
-rw-r--r-- | src/config.c | 14 |
3 files changed, 35 insertions, 2 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index d341edbdc..f84283bc1 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -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" +} diff --git a/include/account.h b/include/account.h index 0949a11cb..d2decf94e 100644 --- a/include/account.h +++ b/include/account.h @@ -15,6 +15,8 @@ class NickRequest time_t lastmail; /* Unsaved */ }; +class NickCore; + class NickAlias { public: 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<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", |