From 1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 May 2013 01:55:04 -0400 Subject: Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in. --- modules/commands/ns_resetpass.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'modules/commands/ns_resetpass.cpp') diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index 3ccb41ec1..f4516c5a6 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -29,7 +29,7 @@ class CommandNSResetPass : public Command { const NickAlias *na; - if (Config->RestrictMail && !source.HasCommand("nickserv/resetpass")) + if (Config->GetBlock("mail")->Get("restrict") && !source.HasCommand("nickserv/resetpass")) source.Reply(ACCESS_DENIED); else if (!(na = NickAlias::Find(params[0]))) source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); @@ -69,8 +69,7 @@ class NSResetPass : public Module NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsresetpass(this) { - - if (!Config->UseMail) + if (!Config->GetBlock("mail")->Get("usemail")) throw ModuleException("Not using mail."); @@ -140,15 +139,15 @@ static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi) for (idx = 0; idx < 20; ++idx) passcode += chars[1 + static_cast((static_cast(max - min)) * static_cast(rand()) / 65536.0) + min]; - Anope::string subject = Language::Translate(na->nc, Config->MailResetSubject.c_str()); - Anope::string message = Language::Translate(na->nc, Config->MailResetMessage.c_str()); + Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get("reset_subject")), + message = Language::Translate(na->nc, Config->GetBlock("mail")->Get("reset_message")); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->NetworkName); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); subject = subject.replace_all_cs("%c", passcode); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->NetworkName); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); message = message.replace_all_cs("%c", passcode); ResetInfo *ri = new ResetInfo; -- cgit