diff options
author | Adam <Adam@anope.org> | 2016-01-23 10:53:32 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-01-23 10:53:32 -0500 |
commit | 38fcf15d6283865f603793dd1afc1fbe5035a6a6 (patch) | |
tree | 430558a634a39309888e7d0133868b3350b209e9 /modules/commands/ns_cert.cpp | |
parent | 75dd784538504b53d5155a96b88aaac6188f950d (diff) |
Put maxlogins logic a few other important places
Diffstat (limited to 'modules/commands/ns_cert.cpp')
-rw-r--r-- | modules/commands/ns_cert.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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<unsigned int>("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<unsigned int>("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; |