summaryrefslogtreecommitdiff
path: root/modules/commands/ns_set.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-09-27 20:07:07 -0400
committerAdam <Adam@anope.org>2013-09-27 20:07:07 -0400
commit4b059beb247a12726d9a471433a27a39190d583b (patch)
treef6daaf13fb81e5c591f02f6cac90687ec592e2c9 /modules/commands/ns_set.cpp
parentb319fb089c144312ab9141d6f6469d50d9d7a1ea (diff)
Replace this silly random code generation code with something more sane looking
Diffstat (limited to 'modules/commands/ns_set.cpp')
-rw-r--r--modules/commands/ns_set.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 11b6fd9d1..e561a1524 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -387,17 +387,7 @@ class CommandNSSetEmail : public Command
{
static bool SendConfirmMail(User *u, BotInfo *bi, const Anope::string &new_email)
{
- int chars[] = {
- ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
- 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
- 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
- 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
- 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
- };
- int idx, min = 1, max = 62;
- Anope::string code;
- for (idx = 0; idx < 9; ++idx)
- code += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min];
+ Anope::string code = Anope::Random(9);
std::pair<Anope::string, Anope::string> *n = u->Account()->Extend<std::pair<Anope::string, Anope::string> >("ns_set_email");
n->first = new_email;