From 257156c10a918bf9ba4eb7ca4baf043095a5f369 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 9 Oct 2016 22:15:42 -0400 Subject: Add max vhosts configuration option --- modules/hostserv/request.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'modules/hostserv/request.cpp') diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp index 3cc2b1aa9..dcaed4913 100644 --- a/modules/hostserv/request.cpp +++ b/modules/hostserv/request.cpp @@ -212,6 +212,13 @@ class CommandHSRequest : public Command return; } + unsigned int max_vhosts = Config->GetModule("hostserv/main")->Get("max_vhosts"); + if (max_vhosts && max_vhosts >= u->Account()->GetRefs().size()) + { + source.Reply(_("You already has the maximum number of vhosts allowed (\002{0}\002)."), max_vhosts); + return; + } + HostRequest *req = u->Account()->GetRef(); if (req != nullptr) req->Delete(); // delete old request @@ -265,7 +272,14 @@ class CommandHSActivate : public Command HostRequest *req = na->GetAccount()->GetRef(); if (!req) { - source.Reply(_("\002{0}\002 does not have a pending vhost request."), na->GetNick()); + source.Reply(_("\002{0}\002 does not have a pending vhost request."), na->GetAccount()->GetDisplay()); + return; + } + + unsigned int max_vhosts = Config->GetModule("hostserv/main")->Get("max_vhosts"); + if (max_vhosts && max_vhosts >= na->GetAccount()->GetRefs().size()) + { + source.Reply(_("\002{0}\002 already has the maximum number of vhosts allowed (\002{1}\002)."), na->GetAccount()->GetDisplay(), max_vhosts); return; } -- cgit