1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 06:13:13 +02:00

Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9

This commit is contained in:
lethality
2012-02-23 02:32:49 +00:00
5 changed files with 32 additions and 13 deletions
+4 -2
View File
@@ -81,9 +81,11 @@ nickserv
confirmemailchanges = no
/*
* Require an e-mail to be sent to the user before they can register their nick.
* Registration confirmation setting. Set to "none" for no registration confirmation,
* "mail" for email confirmation, and "admin" to have services operators manually confirm
* every registration. Set to "disable" to completely disable all registrations.
*/
#emailregistration = yes
registration = "none"
/*
* The default options for newly registered nicks. Note that changing these options
+1
View File
@@ -2,6 +2,7 @@ Anope Version 1.9.7
-------------------
operserv:notifications removed in favor of log{} blocks
options:regexengine added
nickserv:registration added, emailregistration removed.
Anope Version 1.9.6
-------------------
+2 -2
View File
@@ -529,8 +529,8 @@ class CoreExport ServerConfig
bool NSSecureAdmins;
/* Services opers must be /operd on the ircd aswell */
bool NSStrictPrivileges;
/* Use email to verify new users registering */
bool NSEmailReg;
/* Type of confirmation to use, or to disable registration completely */
Anope::string NSRegistration;
/* Core NickServ modules */
Anope::string NickCoreModules;
/* Set the proper channel modes on users when they identify */
+18 -5
View File
@@ -121,6 +121,12 @@ class CommandNSRegister : public Command
return;
}
if (Config->NSRegistration.equals_ci("disable"))
{
source.Reply(_("Registration is currently disabled."));
return;
}
if (!u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
{
source.Reply(_("You must have been using this nick for at least %d seconds to register."), Config->NickRegDelay);
@@ -190,7 +196,12 @@ class CommandNSRegister : public Command
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
source.Reply(_("Your password is \002%s\002 - remember this for later use."), tmp_pass.c_str());
if (Config->NSEmailReg)
if (Config->NSRegistration.equals_ci("admin"))
{
na->nc->SetFlag(NI_UNCONFIRMED);
source.Reply(_("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed."));
}
else if (Config->NSRegistration.equals_ci("mail"))
{
na->nc->SetFlag(NI_UNCONFIRMED);
if (SendRegmail(u, na, source.owner))
@@ -199,7 +210,7 @@ class CommandNSRegister : public Command
source.Reply(_("If you do not confirm your email address within %s your account will expire."), duration(Config->NSUnconfirmedExpire).c_str());
}
}
else
else if (Config->NSRegistration.equals_ci("none"))
{
ircdproto->SendLogin(u);
if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
@@ -261,7 +272,7 @@ class CommandNSResend : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
if (!Config->NSEmailReg)
if (Config->NSRegistration.equals_ci("mail"))
return;
User *u = source.u;
@@ -290,7 +301,7 @@ class CommandNSResend : public Command
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
if (!Config->NSEmailReg)
if (Config->NSRegistration.equals_ci("mail"))
return false;
this->SendSyntax(source);
@@ -302,7 +313,7 @@ class CommandNSResend : public Command
void OnServHelp(CommandSource &source) anope_override
{
if (Config->NSEmailReg)
if (Config->NSRegistration.equals_ci("mail"))
Command::OnServHelp(source);
}
};
@@ -319,6 +330,8 @@ class NSRegister : public Module
{
this->SetAuthor("Anope");
if (Config->NSRegistration.equals_ci("disable"))
throw ModuleException("Module will not load with nickserv:registration disabled.");
}
};
+7 -4
View File
@@ -318,17 +318,17 @@ bool ValidateNotZero(ServerConfig *, const Anope::string &tag, const Anope::stri
bool ValidateEmailReg(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data)
{
if (config->NSEmailReg)
if (!config->NSRegistration.equals_ci("none") && !config->NSRegistration.equals_ci("disable"))
{
if (value.equals_ci("unconfirmedexpire"))
{
if (!data.GetInteger() && dotime(data.GetValue()) <= 0)
throw ConfigException("The value for <" + tag + ":" + value + "> must be non-zero when e-mail registration are enabled!");
throw ConfigException("The value for <" + tag + ":" + value + "> must be non-zero when e-mail or admin registration is enabled!");
}
else
{
if (!data.GetBool())
throw ConfigException("The value for <" + tag + ":" + value + "> must be set to yes when e-mail registrations are enabled!");
throw ConfigException("The value for <" + tag + ":" + value + "> must be set to yes when e-mail or admin registrations is enabled!");
}
}
return true;
@@ -366,6 +366,9 @@ bool ValidateNickServ(ServerConfig *config, const Anope::string &tag, const Anop
if (data.GetValue().length() > 21)
throw ConfigException("The value for <nickserv:guestnickprefix> cannot exceed 21 characters in length!");
}
else if (value.equals_ci("registration"))
if (!data.GetValue().equals_ci("none") && !data.GetValue().equals_ci("mail") && !data.GetValue().equals_ci("admin") && !data.GetValue().equals_ci("registration"))
throw ConfigException("The value for <nickserv:registration> must be one of \"none\", \"mail\", \"admin\", or \"disable\"");
}
return true;
}
@@ -1158,7 +1161,7 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"options", "nonicknameownership", "no", new ValueContainerBool(&conf->NoNicknameOwnership), DT_BOOLEAN | DT_NORELOAD, NoValidation},
{"options", "regexengine", "", new ValueContainerString(&conf->RegexEngine), DT_STRING, NoValidation},
{"nickserv", "name", "", new ValueContainerString(&conf->NickServ), DT_STRING, NoValidation},
{"nickserv", "emailregistration", "no", new ValueContainerBool(&conf->NSEmailReg), DT_BOOLEAN, NoValidation},
{"nickserv", "registration", "none", new ValueContainerString(&conf->NSRegistration), DT_STRING, ValidateNickServ},
{"nickserv", "forceemail", "no", new ValueContainerBool(&conf->NSForceEmail), DT_BOOLEAN, ValidateEmailReg},
{"nickserv", "confirmemailchanges", "no", new ValueContainerBool(&conf->NSConfirmEmailChanges), DT_BOOLEAN, NoValidation},
{"nickserv", "defaults", "secure memosignon memoreceive", new ValueContainerString(&NSDefaults), DT_STRING, NoValidation},