summaryrefslogtreecommitdiff
path: root/modules/commands/os_forbid.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-06-01 14:55:45 -0400
committerAdam <Adam@anope.org>2013-06-01 14:55:45 -0400
commitb56e71ab14b020a3a01f1fbd183382083156aaf4 (patch)
tree0a08e0f848697c9c8c708e2e2156ce6256481fe2 /modules/commands/os_forbid.cpp
parent6f45d7249785b056ed78916d33ec45045a43ed92 (diff)
Move CheckKick event to Channel and make os_forbid use it instead of kicking users in the join event, which does bad things
Diffstat (limited to 'modules/commands/os_forbid.cpp')
-rw-r--r--modules/commands/os_forbid.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index bd837919c..dfb3a6fb1 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -282,35 +282,36 @@ class OSForbid : public Module
}
}
- void OnJoinChannel(User *u, Channel *c) anope_override
+ EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override
{
BotInfo *OperServ = Config->GetClient("OperServ");
if (u->HasMode("OPER") || !OperServ)
- return;
+ return EVENT_CONTINUE;
ForbidData *d = this->forbidService.FindForbid(c->name, FT_CHAN);
if (d != NULL)
{
ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
- if (!chanserv)
- ;
- else if (IRCD->CanSQLineChannel)
+ if (IRCD->CanSQLineChannel)
{
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
+ else if (chanserv)
{
- if (chanserv)
- chanserv->Hold(c);
+ chanserv->Hold(c);
}
if (d->reason.empty())
- c->Kick(OperServ, u, _("This channel has been forbidden."));
+ reason = Language::Translate(u, _("This channel has been forbidden."));
else
- c->Kick(OperServ, u, _("This channel has been forbidden: %s"), d->reason.c_str());
+ reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str());
+
+ return EVENT_STOP;
}
+
+ return EVENT_CONTINUE;
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override