summaryrefslogtreecommitdiff
path: root/modules/commands/ns_register.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-09-25 04:19:15 -0400
committerAdam <Adam@anope.org>2011-09-25 04:19:15 -0400
commit1f2399de364c09adcce4193895cd362d80ffdfc5 (patch)
tree5f40fc531f22c174b6e10bb7bc12842a4a21d30b /modules/commands/ns_register.cpp
parent43201ead9575a74e350710bc191f4ac67366aca7 (diff)
Added a new database format and sqlite support. Also moved db-convert to a module.
Diffstat (limited to 'modules/commands/ns_register.cpp')
-rw-r--r--modules/commands/ns_register.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index aced3046e..acfcd2acd 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -46,8 +46,8 @@ class CommandNSConfirm : public Command
}
else if (u->Account())
{
- Anope::string code;
- if (u->Account()->GetExtRegular<Anope::string>("ns_register_passcode", code) && code == passcode)
+ Anope::string *code = u->Account()->GetExt<Anope::string *>("ns_register_passcode");
+ if (code != NULL && *code == passcode)
{
u->Account()->Shrink("ns_register_passcode");
Log(LOG_COMMAND, u, this) << "to confirm their email";
@@ -320,8 +320,9 @@ class NSRegister : public Module
static bool SendRegmail(User *u, NickAlias *na, BotInfo *bi)
{
- Anope::string code;
- if (na->nc->GetExtRegular<Anope::string>("ns_register_passcode", code) == false)
+ Anope::string *code = na->nc->GetExt<Anope::string *>("ns_register_passcode");
+ Anope::string codebuf;
+ if (code == NULL)
{
int chars[] = {
' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
@@ -332,20 +333,22 @@ static bool SendRegmail(User *u, NickAlias *na, BotInfo *bi)
};
int idx, min = 1, max = 62;
for (idx = 0; idx < 9; ++idx)
- code += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
- na->nc->Extend("ns_register_passcode", new ExtensibleItemRegular<Anope::string>(code));
+ codebuf += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
+ na->nc->Extend("ns_register_passcode", new ExtensibleString(codebuf));
}
+ else
+ codebuf = *code;
Anope::string subject = translate(na->nc, Config->MailRegistrationSubject.c_str());
Anope::string message = translate(na->nc, Config->MailRegistrationMessage.c_str());
subject = subject.replace_all_cs("%n", na->nick);
subject = subject.replace_all_cs("%N", Config->NetworkName);
- subject = subject.replace_all_cs("%c", code);
+ subject = subject.replace_all_cs("%c", codebuf);
message = message.replace_all_cs("%n", na->nick);
message = message.replace_all_cs("%N", Config->NetworkName);
- message = message.replace_all_cs("%c", code);
+ message = message.replace_all_cs("%c", codebuf);
return Mail(u, na->nc, bi, subject, message);
}