From f90b2dc3dbdb79a50933a0034b2339693615b02a Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 24 Jun 2017 16:20:08 -0400 Subject: Add hostserv ban command to ban users from requesting vhosts --- modules/hostserv/request.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'modules/hostserv/request.cpp') diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp index e6db9f790..596a0050e 100644 --- a/modules/hostserv/request.cpp +++ b/modules/hostserv/request.cpp @@ -122,7 +122,7 @@ class CommandHSRequest : public Command if (!na) continue; - Anope::string message = Anope::printf(_("[auto memo] vHost \002%s\002 has been requested by %s."), host.c_str(), source.GetNick().c_str()); + Anope::string message = Anope::Format(_("[auto memo] vHost \002{0}\002 has been requested by {1}."), host, source.GetNick()); memoserv->Send(source.service->nick, na->GetNick(), message, true); } @@ -208,18 +208,22 @@ class CommandHSRequest : public Command time_t send_delay = Config->GetModule("memoserv/main")->Get("senddelay"); if (Config->GetModule(this->GetOwner())->Get("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime) { - source.Reply(_("Please wait %d seconds before requesting a new vHost."), send_delay); + source.Reply(_("Please wait \002{0}\002 seconds before requesting a new vHost."), send_delay); u->lastmemosend = Anope::CurTime; return; } unsigned int max_vhosts = Config->GetModule("hostserv/main")->Get("max_vhosts"); - if (max_vhosts && max_vhosts >= u->Account()->GetRefs().size()) + if (max_vhosts && u->Account()->GetRefs().size() >= max_vhosts) { source.Reply(_("You already have the maximum number of vhosts allowed (\002{0}\002)."), max_vhosts); return; } + EventReturn event_ret = EventManager::Get()->Dispatch(&Event::VhostRequest::OnVhostRequest, &source, u->Account(), user, host); + if (event_ret == EVENT_STOP) + return; + HostRequest *req = u->Account()->GetRef(); if (req != nullptr) req->Delete(); // delete old request -- cgit