diff options
Diffstat (limited to 'modules/operserv/os_defcon.cpp')
-rw-r--r-- | modules/operserv/os_defcon.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/modules/operserv/os_defcon.cpp b/modules/operserv/os_defcon.cpp index 65a6555a6..5fd2d59bb 100644 --- a/modules/operserv/os_defcon.cpp +++ b/modules/operserv/os_defcon.cpp @@ -331,31 +331,34 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); DefconConfig dconfig; - dconfig.defaultlevel = block->Get<int>("defaultlevel"); - dconfig.defcons[4] = block->Get<const Anope::string>("level4"); - dconfig.defcons[3] = block->Get<const Anope::string>("level3"); - dconfig.defcons[2] = block->Get<const Anope::string>("level2"); - dconfig.defcons[1] = block->Get<const Anope::string>("level1"); - dconfig.sessionlimit = block->Get<int>("sessionlimit"); - dconfig.akillreason = block->Get<const Anope::string>("akillreason"); - dconfig.akillexpire = block->Get<time_t>("akillexpire"); - dconfig.chanmodes = block->Get<const Anope::string>("chanmodes"); - dconfig.timeout = block->Get<time_t>("timeout"); - dconfig.globalondefcon = block->Get<bool>("globalondefcon"); - dconfig.message = block->Get<const Anope::string>("message"); - dconfig.offmessage = block->Get<const Anope::string>("offmessage"); - - block = conf->GetModule("os_session"); - - dconfig.max_session_kill = block->Get<int>("maxsessionkill"); - dconfig.session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry"); - dconfig.sle_reason = block->Get<const Anope::string>("sessionlimitexceeded"); - dconfig.sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc"); + { + Configuration::Block &block = conf.GetModule(this); + dconfig.defaultlevel = block.Get<int>("defaultlevel"); + dconfig.defcons[4] = block.Get<const Anope::string>("level4"); + dconfig.defcons[3] = block.Get<const Anope::string>("level3"); + dconfig.defcons[2] = block.Get<const Anope::string>("level2"); + dconfig.defcons[1] = block.Get<const Anope::string>("level1"); + dconfig.sessionlimit = block.Get<int>("sessionlimit"); + dconfig.akillreason = block.Get<const Anope::string>("akillreason"); + dconfig.akillexpire = block.Get<time_t>("akillexpire"); + dconfig.chanmodes = block.Get<const Anope::string>("chanmodes"); + dconfig.timeout = block.Get<time_t>("timeout"); + dconfig.globalondefcon = block.Get<bool>("globalondefcon"); + dconfig.message = block.Get<const Anope::string>("message"); + dconfig.offmessage = block.Get<const Anope::string>("offmessage"); + } + + { + Configuration::Block &block = conf.GetModule("os_session"); + dconfig.max_session_kill = block.Get<int>("maxsessionkill"); + dconfig.session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry"); + dconfig.sle_reason = block.Get<const Anope::string>("sessionlimitexceeded"); + dconfig.sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc"); + } if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5) throw ConfigException("The value for <defcon:defaultlevel> must be between 1 and 5"); |