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:15:20 +0000
committerNaram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-19 20:15:20 +0000
commit6e943066a5e9289088fb68d24365d6e72f5406fb (patch)
treec5d89a1901f80d64f20a09a2598fb2e8c7db44fc
parent43d849376dbcc5e3135f25bde17c1a696d077643 (diff)
Added keepdata directive to botserv block in new config.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1456 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--data/example_new.conf7
-rw-r--r--include/extern.h2
-rw-r--r--src/config.c7
3 files changed, 11 insertions, 5 deletions
diff --git a/data/example_new.conf b/data/example_new.conf
index f49fa1242..2329b7ef1 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -544,4 +544,11 @@ botserv
* reduce performance slightly.
*/
badwordsmax = 32
+
+ /*
+ * The amount of time that data for a user is valid in BotServ. If the data exceeds this time,
+ * it is reset or deleted depending on the case. Do not set it too high, otherwise your
+ * resources will be slightly affected.
+ */
+ keepdata = 10m
}
diff --git a/include/extern.h b/include/extern.h
index 70c8b2620..33fdba240 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -360,7 +360,7 @@ E bool MSNotifyAll;
E int MSMemoReceipt;
E int BSDefFlags;
-E int BSKeepData;
+E time_t BSKeepData;
E int BSMinUsers;
E int BSBadWordsMax;
E int BSSmartJoin;
diff --git a/src/config.c b/src/config.c
index 3d320f4d0..a0e80e61b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -163,7 +163,7 @@ int MSMemoReceipt;
static std::string BSDefaults;
int BSDefFlags;
-int BSKeepData;
+time_t BSKeepData;
int BSMinUsers;
int BSBadWordsMax;
int BSSmartJoin;
@@ -485,7 +485,7 @@ 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" || static_cast<std::string>(value) == "badwordsmax") {
+ else if (static_cast<std::string>(value) == "minusers" || static_cast<std::string>(value) == "badwordsmax" || static_cast<std::string>(value) == "keepdata") {
if (!data.GetInteger()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be non-zero when BotServ is enabled!");
}
}
@@ -615,6 +615,7 @@ int ServerConfig::Read(bool bail)
{"botserv", "defaults", "", new ValueContainerString(&BSDefaults), DT_STRING, NoValidation},
{"botserv", "minusers", "0", new ValueContainerInt(&BSMinUsers), DT_INTEGER, ValidateBotServ},
{"botserv", "badwordsmax", "0", new ValueContainerInt(&BSBadWordsMax), DT_INTEGER, ValidateBotServ},
+ {"botserv", "keepdata", "0", new ValueContainerTime(&BSKeepData), DT_TIME, ValidateBotServ},
{NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation}
};
/* These tags can occur multiple times, and therefore they have special code to read them
@@ -1199,7 +1200,6 @@ Directive directives[] = {
{"BSFantasyCharacter",
{{PARAM_STRING, PARAM_RELOAD, &BSFantasyCharacter}}},
{"BSGentleBWReason", {{PARAM_SET, PARAM_RELOAD, &BSGentleBWReason}}},
- {"BSKeepData", {{PARAM_TIME, PARAM_RELOAD, &BSKeepData}}},
{"BSSmartJoin", {{PARAM_SET, PARAM_RELOAD, &BSSmartJoin}}},
{"HostServDB", {{PARAM_STRING, PARAM_RELOAD, &HostDBName}}},
{"HostServName", {{PARAM_STRING, 0, &s_HostServ},
@@ -1894,7 +1894,6 @@ int read_config(int reload)
}
if (s_BotServ) {
- CHECK(BSKeepData);
if (!BSFantasyCharacter)
BSFantasyCharacter = sstrdup("!");
if (BSFantasyCharacter && (strlen(BSFantasyCharacter) > 1)) {