summaryrefslogtreecommitdiff
path: root/modules/core/ns_resetpass.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-22 03:16:11 -0400
committerAdam <Adam@anope.org>2011-05-16 04:06:17 -0400
commitc8c23158a4ff74822d6c7d201dc53d879e3d91e8 (patch)
tree4bc9ae029691d5e7c03ebc1481683a010b733844 /modules/core/ns_resetpass.cpp
parent1782ce260c5bc214ec0b2e39257ab1371b68ae9c (diff)
Moved the core pseudo clients out into their own modules
Diffstat (limited to 'modules/core/ns_resetpass.cpp')
-rw-r--r--modules/core/ns_resetpass.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/core/ns_resetpass.cpp b/modules/core/ns_resetpass.cpp
index 626af80c8..3cbbe5903 100644
--- a/modules/core/ns_resetpass.cpp
+++ b/modules/core/ns_resetpass.cpp
@@ -12,6 +12,7 @@
/*************************************************************************/
#include "module.h"
+#include "nickserv.h"
static bool SendResetEmail(User *u, NickAlias *na);
@@ -68,13 +69,16 @@ class NSResetPass : public Module
public:
NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator)
{
- if (!Config->UseMail)
- throw ModuleException("Not using mail.");
-
this->SetAuthor("Anope");
this->SetType(CORE);
- this->AddCommand(NickServ, &commandnsresetpass);
+ if (!nickserv)
+ throw ModuleException("NickServ is not loaded!");
+
+ if (!Config->UseMail)
+ throw ModuleException("Not using mail.");
+
+ this->AddCommand(nickserv->Bot(), &commandnsresetpass);
ModuleManager::Attach(I_OnPreCommand, this);
}
@@ -82,7 +86,7 @@ class NSResetPass : public Module
EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> &params)
{
User *u = source.u;
- if (command->service == NickServ && command->name.equals_ci("CONFIRM") && params.size() > 1)
+ if (command->service->nick == Config->s_NickServ && command->name.equals_ci("CONFIRM") && params.size() > 1)
{
NickAlias *na = findnick(params[0]);
@@ -151,7 +155,7 @@ static bool SendResetEmail(User *u, NickAlias *na)
na->nc->Extend("ns_resetpass_code", new ExtensibleItemRegular<Anope::string>(passcode));
na->nc->Extend("ns_resetpass_time", new ExtensibleItemRegular<time_t>(Anope::CurTime));
- return Mail(u, na->nc, NickServ, subject, message);
+ return Mail(u, na->nc, nickserv->Bot(), subject, message);
}
MODULE_INIT(NSResetPass)