diff options
author | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-27 00:46:10 +0000 |
---|---|---|
committer | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-27 00:46:10 +0000 |
commit | 0d02abf9a8a00bd8892100026fad715bb528a862 (patch) | |
tree | 5517ee527737b3bcf0d6160a208654b20f750c99 | |
parent | e3ab258551191bbacf059817603a4300035694f1 (diff) |
Added akillexpire directive to defcon block in new config.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1494 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | data/example_new.conf | 6 | ||||
-rw-r--r-- | include/extern.h | 2 | ||||
-rw-r--r-- | src/config.c | 6 | ||||
-rw-r--r-- | src/users.c | 2 |
4 files changed, 11 insertions, 5 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index 52beadea2..df8cfbad1 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -906,4 +906,10 @@ defcon * New session limit to use when a DefCon level is using "reduced" session limiting. */ #sessionlimit = 2 + + /* + * Length of time to add an AKILL for when DefCon is preventing new clients from connecting to the + * network. + */ + #akillexpire = 5m } diff --git a/include/extern.h b/include/extern.h index b9b03c3c5..4f2bd4470 100644 --- a/include/extern.h +++ b/include/extern.h @@ -507,7 +507,7 @@ E int checkDefCon(int level); E void resetDefCon(int level); E int DefConSessionLimit; E char *DefConTimeOut; -E char *DefConAKILL; +E time_t DefConAKILL; E char *DefConChanModes; E int GlobalOnDefcon; E int GlobalOnDefconMore; diff --git a/src/config.c b/src/config.c index 3ab9d0a11..0dc418808 100644 --- a/src/config.c +++ b/src/config.c @@ -287,7 +287,7 @@ static std::string DefCon4; int DefCon[6]; char *DefConTimeOut; int DefConSessionLimit; -char *DefConAKILL; +time_t DefConAKILL; char *DefConChanModes; int GlobalOnDefcon; int GlobalOnDefconMore; @@ -523,7 +523,7 @@ bool ValidateDefCon(ServerConfig *, const char *tag, const char *value, ValueIte if (static_cast<std::string>(value).substr(0, 5) == "level" && isdigit(value[5])) { if (!*data.GetString()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> cannot be empty when DefCon is enabled!"); } - else if (static_cast<std::string>(value) == "sessionlimit") { + else if (static_cast<std::string>(value) == "sessionlimit" || static_cast<std::string>(value) == "akillexpire") { if (!data.GetInteger()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be non-zero when DefCon is enabled!"); } } @@ -701,6 +701,7 @@ int ServerConfig::Read(bool bail) {"defcon", "level2", "", new ValueContainerString(&DefCon2), DT_STRING, ValidateDefCon}, {"defcon", "level1", "", new ValueContainerString(&DefCon1), DT_STRING, ValidateDefCon}, {"defcon", "sessionlimit", "0", new ValueContainerInt(&DefConSessionLimit), DT_INTEGER, ValidateDefCon}, + {"defcon", "akillexpire", "0", new ValueContainerTime(&DefConAKILL), DT_TIME, ValidateDefCon}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1281,7 +1282,6 @@ Directive directives[] = { {"DontQuoteAddresses", {{PARAM_SET, PARAM_RELOAD, &DontQuoteAddresses}}}, {"DumpCore", {{PARAM_SET, 0, &DumpCore}}}, - {"DefConAkillExpire", {{PARAM_STRING, PARAM_RELOAD, &DefConAKILL}}}, {"DefConChanModes", {{PARAM_STRING, PARAM_RELOAD, &DefConChanModes}}}, {"DefConTimeOut", {{PARAM_STRING, PARAM_RELOAD, &DefConTimeOut}}}, {"DefConAkillReason", diff --git a/src/users.c b/src/users.c index 5dbff3e5c..f03b39837 100644 --- a/src/users.c +++ b/src/users.c @@ -589,7 +589,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const strncat(mask, host, HOSTMAX); alog("DEFCON: adding akill for %s", mask); add_akill(NULL, mask, s_OperServ, - time(NULL) + dotime(DefConAKILL), + time(NULL) + DefConAKILL, DefConAkillReason ? DefConAkillReason : "DEFCON AKILL"); if (check_akill(nick, username, host, vhost, ipbuf)) { |