1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 02:46:37 +02:00

Do not allow nickserv/ungroup to bypass ns_maxemail, and allow opers to bypass ns_maxemail

This commit is contained in:
Adam
2014-03-10 04:30:27 -04:00
parent 8d1ad6fbe5
commit b0597e35ec
2 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -640,7 +640,7 @@ command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
* Limits how many times the same email address may be used in Anope
* to register accounts.
*/
module
#module
{
name = "ns_maxemail"
@@ -649,5 +649,5 @@ module
* commented, there will be no limit enforced when registering new accounts or using
* /msg NickServ SET EMAIL.
*/
#maxemails = 1
maxemails = 1
}
+10 -2
View File
@@ -25,9 +25,9 @@ class NSMaxEmail : public Module
return false;
if (NSEmailMax == 1)
source.Reply(_("The given email address has reached its usage limit of 1 user."));
source.Reply(_("The email address \2%s\2 has reached its usage limit of 1 user."), email.c_str());
else
source.Reply(_("The given email address has reached its usage limit of %d users."), NSEmailMax);
source.Reply(_("The email address \2%s\2 has reached its usage limit of %d users."), email.c_str(), NSEmailMax);
return true;
}
@@ -57,6 +57,9 @@ class NSMaxEmail : public Module
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
{
if (source.IsOper())
return EVENT_CONTINUE;
if (command->name == "nickserv/register")
{
if (this->CheckLimitReached(source, params.size() > 1 ? params[1] : ""))
@@ -67,6 +70,11 @@ class NSMaxEmail : public Module
if (this->CheckLimitReached(source, params.size() > 0 ? params[0] : ""))
return EVENT_STOP;
}
else if (command->name == "nickserv/ungroup" && source.GetAccount())
{
if (this->CheckLimitReached(source, source.GetAccount()->email))
return EVENT_STOP;
}
return EVENT_CONTINUE;
}