summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-19 20:06:11 +0000
committerNaram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-19 20:06:11 +0000
commita71c8271dd68661c78026fa1bb67e735f3aa9ed0 (patch)
tree9abf3623fa28f916cb7e29f5b7b061936cdf31c3
parent9ca710a2a0aabd528514908f8f68f71021be5592 (diff)
Added minusers directive to botserv block in new config.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1454 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--data/example_new.conf7
-rw-r--r--src/config.c6
2 files changed, 11 insertions, 2 deletions
diff --git a/data/example_new.conf b/data/example_new.conf
index ff19061b3..22ab698cd 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -531,4 +531,11 @@ botserv
* This directive is optional, if left blank, there will be no defaults.
*/
defaults="greet fantasy symbiosis"
+
+ /*
+ * The minimum number of users there must be in a channel before the bot joins it. The best
+ * value for this setting is 1 or 2. This cannot be 0, otherwise topic retention and mode
+ * lock and such other things won't work.
+ */
+ minusers = 1
}
diff --git a/src/config.c b/src/config.c
index abfd6b627..8c6cf88f9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -485,6 +485,9 @@ bool ValidateBotServ(ServerConfig *, const char *tag, const char *value, ValueIt
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 BotServ is enabled!");
}
+ else if (static_cast<std::string>(value) == "minusers") {
+ if (!data.GetInteger()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be non-zero when BotServ is enabled!");
+ }
}
return true;
}
@@ -610,6 +613,7 @@ int ServerConfig::Read(bool bail)
{"botserv", "description", "Bot Service", new ValueContainerChar(&desc_BotServ), DT_CHARPTR, ValidateBotServ},
{"botserv", "database", "bot.db", new ValueContainerChar(&BotDBName), DT_CHARPTR, ValidateBotServ},
{"botserv", "defaults", "", new ValueContainerString(&BSDefaults), DT_STRING, NoValidation},
+ {"botserv", "minusers", "0", new ValueContainerInt(&BSMinUsers), DT_INTEGER, ValidateBotServ},
{NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation}
};
/* These tags can occur multiple times, and therefore they have special code to read them
@@ -1196,7 +1200,6 @@ Directive directives[] = {
{{PARAM_STRING, PARAM_RELOAD, &BSFantasyCharacter}}},
{"BSGentleBWReason", {{PARAM_SET, PARAM_RELOAD, &BSGentleBWReason}}},
{"BSKeepData", {{PARAM_TIME, PARAM_RELOAD, &BSKeepData}}},
- {"BSMinUsers", {{PARAM_POSINT, PARAM_RELOAD, &BSMinUsers}}},
{"BSSmartJoin", {{PARAM_SET, PARAM_RELOAD, &BSSmartJoin}}},
{"HostServDB", {{PARAM_STRING, PARAM_RELOAD, &HostDBName}}},
{"HostServName", {{PARAM_STRING, 0, &s_HostServ},
@@ -1892,7 +1895,6 @@ int read_config(int reload)
if (s_BotServ) {
CHECK(BSBadWordsMax);
- CHECK(BSMinUsers);
CHECK(BSKeepData);
if (!BSFantasyCharacter)
BSFantasyCharacter = sstrdup("!");