From 38fcf15d6283865f603793dd1afc1fbe5035a6a6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Jan 2016 10:53:32 -0500 Subject: Put maxlogins logic a few other important places --- modules/commands/ns_cert.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules') diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index aedb816d2..87702b834 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -362,6 +362,13 @@ class NSCert : public Module if (!nc || nc->HasExt("NS_SUSPENDED")) return; + unsigned int maxlogins = Config->GetModule("ns_identify")->Get("maxlogins"); + if (maxlogins && nc->users.size() >= maxlogins) + { + u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), nc->display.c_str(), maxlogins); + return; + } + NickAlias *na = NickAlias::Find(u->nick); if (na && na->nc == nc) u->Identify(na); @@ -378,7 +385,16 @@ class NSCert : public Module if (!u->fingerprint.empty() && cl && cl->FindCert(u->fingerprint)) { BotInfo *NickServ = Config->GetClient("NickServ"); + + unsigned int maxlogins = Config->GetModule("ns_identify")->Get("maxlogins"); + if (maxlogins && na->nc->users.size() >= maxlogins) + { + u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins); + return EVENT_CONTINUE; + } + u->Identify(na); + u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified.")); Log(NickServ) << u->GetMask() << " automatically identified for account " << na->nc->display << " via SSL certificate fingerprint"; return EVENT_ALLOW; -- cgit