diff options
author | Adam <Adam@anope.org> | 2010-09-11 22:47:36 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-09-11 22:47:36 -0400 |
commit | e30370af107e4ae46c5287c7cfa01b679bcc25b3 (patch) | |
tree | 6953bbe0110abd2cfe1baa0158fda5d74d477a57 /modules/core/ns_identify.cpp | |
parent | 89c5b203c331ab7c2986c93fd77fcc39c04d1d07 (diff) |
Allow identifying to other accounts using /nickserv id account pass
Diffstat (limited to 'modules/core/ns_identify.cpp')
-rw-r--r-- | modules/core/ns_identify.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/core/ns_identify.cpp b/modules/core/ns_identify.cpp index e87d13d22..943847355 100644 --- a/modules/core/ns_identify.cpp +++ b/modules/core/ns_identify.cpp @@ -16,21 +16,21 @@ class CommandNSIdentify : public Command { public: - CommandNSIdentify(const Anope::string &cname) : Command(cname, 1, 1) + CommandNSIdentify(const Anope::string &cname) : Command(cname, 1, 2) { this->SetFlag(CFLAG_ALLOW_UNREGISTERED); } CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { - Anope::string pass = params[0]; - NickAlias *na; - NickRequest *nr; - int res; + Anope::string nick = params.size() == 2 ? params[0] : u->nick; + Anope::string pass = params[params.size() - 1]; - if (!(na = findnick(u->nick))) + NickAlias *na = findnick(nick), *this_na = findnick(u->nick); + if (!na) { - if ((nr = findrequestnick(u->nick))) + NickRequest *nr = findrequestnick(nick); + if (nr) notice_lang(Config->s_NickServ, u, NICK_IS_PREREG); else notice_lang(Config->s_NickServ, u, NICK_NOT_REGISTERED); @@ -47,7 +47,7 @@ class CommandNSIdentify : public Command notice_lang(Config->s_NickServ, u, NICK_ALREADY_IDENTIFIED); else { - res = enc_check_password(pass, na->nc->pass); + int res = enc_check_password(pass, na->nc->pass); if (!res) { Log(LOG_COMMAND, u, this) << "and failed to identify"; @@ -69,6 +69,9 @@ class CommandNSIdentify : public Command ircdproto->SendAccountLogin(u, u->Account()); ircdproto->SetAutoIdentificationToken(u); + if (this_na && this_na->nc == na->nc) + u->SetMode(NickServ, UMODE_REGISTERED); + u->UpdateHost(); FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u)); |