summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-07-31 06:24:11 -0400
committerAdam <Adam@anope.org>2011-07-31 06:24:11 -0400
commitb751800ff44529d5ce4d7b6f9482565bd01bea55 (patch)
tree929a1cc5679b62b917917189c9f9334c0a9e1bb8
parentf32149117a0b32a26a7695760f29d1a2b10332c5 (diff)
Fixed os_defcon
-rw-r--r--modules/extra/os_defcon.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/extra/os_defcon.cpp b/modules/extra/os_defcon.cpp
index 9cfe66e09..26120feff 100644
--- a/modules/extra/os_defcon.cpp
+++ b/modules/extra/os_defcon.cpp
@@ -46,7 +46,8 @@ struct DefconConfig
DefconConfig()
{
- this->DefCon.resize(5);
+ this->DefCon.resize(6);
+ this->defcons.resize(5);
}
bool Check(DefconLevel level)
@@ -339,14 +340,18 @@ class OSDefcon : public Module
this->SetAuthor("Anope");
Implementation i[] = { I_OnReload, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnPreCommand, I_OnUserConnect, I_OnChannelModeAdd, I_OnChannelCreate };
- ModuleManager::Attach(i, this, 8);
+ ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::RegisterService(&commandosdefcon);
- this->OnReload();
-
- if (!DConfig.defaultlevel)
- throw ModuleException("Invalid configuration settings");
+ try
+ {
+ this->OnReload();
+ }
+ catch (const ConfigException &ex)
+ {
+ throw ModuleException(ex.GetReason());
+ }
}
void OnReload()
@@ -360,6 +365,7 @@ class OSDefcon : public Module
dconfig.defcons[2] = config.ReadValue("defcon", "level2", 0);
dconfig.defcons[1] = config.ReadValue("defcon", "level1", 0);
dconfig.sessionlimit = config.ReadInteger("defcon", "sessionlimit", 0, 0);
+ dconfig.akillreason = config.ReadValue("defcon", "akillreason", 0);
dconfig.akillexpire = dotime(config.ReadValue("defcon", "akillexpire", 0));
dconfig.chanmodes = config.ReadValue("defcon", "chanmodes", 0);
dconfig.timeout = dotime(config.ReadValue("defcon", "timeout", 0));