summaryrefslogtreecommitdiff
path: root/modules/commands/os_forbid.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-05-05 01:55:04 -0400
committerAdam <Adam@anope.org>2013-05-05 01:55:04 -0400
commit1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b (patch)
tree4486f0784bdf050fd7eb225c0cb9df352ce1f45a /modules/commands/os_forbid.cpp
parent781defb7076ddfddf723ca08cd0a518b6657b64f (diff)
Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.
Diffstat (limited to 'modules/commands/os_forbid.cpp')
-rw-r--r--modules/commands/os_forbid.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 2144aa591..1d99d47b4 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -14,6 +14,8 @@
#include "module.h"
#include "os_forbid.h"
+static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
+
class MyForbidService : public ForbidService
{
Serialize::Checker<std::vector<ForbidData *>[FT_SIZE - 1]> forbid_data;
@@ -121,12 +123,6 @@ class CommandOSForbid : public Command
time_t expiryt = 0;
- if (Config->ForceForbidReason && reason.empty())
- {
- this->OnSyntaxError(source, "");
- return;
- }
-
if (!expiry.empty())
{
expiryt = Anope::DoTime(expiry);
@@ -135,7 +131,7 @@ class CommandOSForbid : public Command
}
NickAlias *target = NickAlias::Find(entry);
- if (target != NULL && Config->NSSecureAdmins && target->nc->IsServicesOper())
+ if (target != NULL && Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper())
{
source.Reply(ACCESS_DENIED);
return;
@@ -234,11 +230,12 @@ class CommandOSForbid : public Command
source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels,\n"
"and email addresses. Wildcards are accepted for all entries."));
- if (!Config->RegexEngine.empty())
+ const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string &>("regexengine");
+ if (!regexengine.empty())
{
source.Reply(" ");
source.Reply(_("Regex matches are also supported using the %s engine.\n"
- "Enclose your pattern in // if this is desired."), Config->RegexEngine.c_str());
+ "Enclose your pattern in // if this is desired."), regexengine.c_str());
}
return true;
@@ -295,21 +292,19 @@ class OSForbid : public Module
ForbidData *d = this->forbidService.FindForbid(c->name, FT_CHAN);
if (d != NULL)
{
- if (IRCD->CanSQLineChannel)
+ ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
+ if (!chanserv)
+ ;
+ else if (IRCD->CanSQLineChannel)
{
- XLine x(c->name, OperServ->nick, Anope::CurTime + Config->CSInhabit, d->reason);
+ time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "15s");
+ XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason);
IRCD->SendSQLine(NULL, &x);
}
- else if (!c->HasExt("INHABIT"))
+ else
{
- /* Join ChanServ and set a timer for this channel to part ChanServ later */
- c->Hold();
-
- /* Set +si to prevent rejoin */
- c->SetMode(NULL, "NOEXTERNAL");
- c->SetMode(NULL, "TOPIC");
- c->SetMode(NULL, "SECRET");
- c->SetMode(NULL, "INVITE");
+ if (chanserv)
+ chanserv->Hold(c);
}
if (d->reason.empty())