From 1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 May 2013 01:55:04 -0400 Subject: Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in. --- modules/commands/os_akill.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'modules/commands/os_akill.cpp') diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index 47121c51f..c90dd096f 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -76,7 +76,7 @@ class CommandOSAKill : public Command sep.GetToken(mask); } - time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->AutokillExpiry; + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get("autokillexpiry", "30d"); /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -121,16 +121,18 @@ class CommandOSAKill : public Command if (mask[0] == '/' && mask[mask.length() - 1] == '/') { - if (Config->RegexEngine.empty()) + const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + + if (regexengine.empty()) { - source.Reply(_("Regex is enabled.")); + source.Reply(_("Regex is disabled.")); return; } - ServiceReference provider("Regex", Config->RegexEngine); + ServiceReference provider("Regex", regexengine); if (!provider) { - source.Reply(_("Unable to find regex engine %s."), Config->RegexEngine.c_str()); + source.Reply(_("Unable to find regex engine %s."), regexengine.c_str()); return; } @@ -158,8 +160,11 @@ class CommandOSAKill : public Command return; } + if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) + reason = "[" + source.GetNick() + "] " + reason; + XLine *x = new XLine(mask, source.GetNick(), expires, reason); - if (Config->AkillIds) + if (Config->GetBlock("operserv")->Get("akilids")) x->id = XLineManager::GenerateUID(); unsigned int affected = 0; @@ -185,7 +190,7 @@ class CommandOSAKill : public Command } akills->AddXLine(x); - if (Config->AkillOnAdd) + if (Config->GetModule("operserv")->Get("akillonadd")) akills->Send(NULL, x); source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str()); @@ -414,11 +419,12 @@ class CommandOSAKill : public Command "be given, even if it is the same as the default. The\n" "current AKILL default expiry time can be found with the\n" "\002STATS AKILL\002 command.")); - if (!Config->RegexEngine.empty()) + const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + if (!regexengine.empty()) { source.Reply(" "); source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your mask in // if this is desired."), Config->RegexEngine.c_str()); + "Enclose your mask in // if this is desired."), regexengine.c_str()); } source.Reply(_( " \n" -- cgit