diff options
author | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-27 01:05:53 +0000 |
---|---|---|
committer | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-27 01:05:53 +0000 |
commit | eaf557fc86db69df9eabccb160f914f963ffe30f (patch) | |
tree | 52e610c81a7a4ce712f3052841817c426ae526aa | |
parent | 7e541ba7e1145c6118f69c7856e50d5976bbb07e (diff) |
Added timeout directive to defcon block in new config.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1496 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | data/example_new.conf | 7 | ||||
-rw-r--r-- | include/extern.h | 2 | ||||
-rw-r--r-- | src/config.c | 4 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/operserv.c | 2 |
5 files changed, 12 insertions, 5 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index 975fef99b..0243d60fe 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -924,4 +924,11 @@ defcon * Note 2: MLOCK'd modes will not be lost. */ #chanmodes = "+R" + + /* + * This value can be used to automatically return the network to DefCon level 5 after the specified + * time period, just in case any IRC Operator forgets to remove a DefCon setting. This directive is + * optional. + */ + #timeout = 15m } diff --git a/include/extern.h b/include/extern.h index 4f2bd4470..7cc0d234f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -506,7 +506,7 @@ E int DefCon[6]; E int checkDefCon(int level); E void resetDefCon(int level); E int DefConSessionLimit; -E char *DefConTimeOut; +E time_t DefConTimeOut; E time_t DefConAKILL; E char *DefConChanModes; E int GlobalOnDefcon; diff --git a/src/config.c b/src/config.c index 74815f393..fc0c4c6cd 100644 --- a/src/config.c +++ b/src/config.c @@ -285,7 +285,7 @@ static std::string DefCon2; static std::string DefCon3; static std::string DefCon4; int DefCon[6]; -char *DefConTimeOut; +time_t DefConTimeOut; int DefConSessionLimit; time_t DefConAKILL; char *DefConChanModes; @@ -703,6 +703,7 @@ int ServerConfig::Read(bool bail) {"defcon", "sessionlimit", "0", new ValueContainerInt(&DefConSessionLimit), DT_INTEGER, ValidateDefCon}, {"defcon", "akillexpire", "0", new ValueContainerTime(&DefConAKILL), DT_TIME, ValidateDefCon}, {"defcon", "chanmodes", "", new ValueContainerChar(&DefConChanModes), DT_CHARPTR, ValidateDefCon}, + {"defcon", "timeout", "0", new ValueContainerTime(&DefConTimeOut), DT_TIME, NoValidation}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1283,7 +1284,6 @@ Directive directives[] = { {"DontQuoteAddresses", {{PARAM_SET, PARAM_RELOAD, &DontQuoteAddresses}}}, {"DumpCore", {{PARAM_SET, 0, &DumpCore}}}, - {"DefConTimeOut", {{PARAM_STRING, PARAM_RELOAD, &DefConTimeOut}}}, {"DefConAkillReason", {{PARAM_STRING, PARAM_RELOAD, &DefConAkillReason}}}, {"DefConOffMessage", diff --git a/src/main.c b/src/main.c index 60a9ce8bf..d70e936ba 100644 --- a/src/main.c +++ b/src/main.c @@ -591,7 +591,7 @@ int main(int ac, char **av, char **envp) last_update = t; } - if ((DefConTimeOut) && (t - last_DefCon >= dotime(DefConTimeOut))) { + if ((DefConTimeOut) && (t - last_DefCon >= DefConTimeOut)) { resetDefCon(5); last_DefCon = t; } diff --git a/src/operserv.c b/src/operserv.c index 20ff4f28e..50e3e078c 100644 --- a/src/operserv.c +++ b/src/operserv.c @@ -1594,7 +1594,7 @@ void resetDefCon(int level) snprintf(strLevel, 4, "%d", level); if (DefConLevel != level) { if ((DefContimer) - && (time(NULL) - DefContimer >= dotime(DefConTimeOut))) { + && (time(NULL) - DefContimer >= DefConTimeOut)) { DefConLevel = level; send_event(EVENT_DEFCON_LEVEL, 1, strLevel); alog("Defcon level timeout, returning to lvl %d", level); |